Chapter 4 Threads Flashcards
What happens when a user level thread ULT blocks in a multithreaded process that is mapped to only one kernel level thread?
The process stops.
List one advantage of having a thread pool.
Faster to service a request with a existing thread.
What is a LWP?
(Light Weight Process), maps user level to kernel level thread to one or more user level thread.
Do threads have their own stack pointer?
yes
Why does it take less time to create a user level thread as opposed too a kernel level thread?
user level thread does not involve kernel, kernel level threads create overhead.
What are the benefits of multithreaded programming?
Responsiveness, Resource sharing, Economy, Utilization of MP Architectures
What are some examples of how threads are used?
File Server, Spread Sheet Program and Word Processor
What’s Solaris’ purpose? Describe some concepts
Implements the one-to-one mapping from LWP to a kernel thread and a one or more mapping between User-level thread.
Process – normal UNIX process
User-level threads – allows application parallelism
Lightweight processes
Kernel threads – entities manipulated by the scheduler
What are the advantages and disadvantages of user-level threads?
Advantages: Portable, scheduling is dependent on application needs, doesn’t require kernel mode intervention when switching threads.
Disadvantages: All threads are blocked when a system function is called
What’s the significance of User level threads?
Thread management, they…….
Create and destroy threads
Communication between threads
Scheduling and saving and restoring thread contexts
Libraries include:
Win32
POSIX Pthreads
java
What’s the advantage and disadvantages of kernel level threads?
Advantage: Supported by the Kernel
Major disadvantage – switching between threads requires a mode switch to the kernel
Examples: Windows XP/2000 Solaris Linux Tru64 UNIX Mac OS X
Many to one
maps many user-level threads to one kernel thread.
Entire process blocks when a blocking system call is invoked.
Because of one kernel thread mapping, other threads can not run in parallel on a multiprocessor.
Examples:
Solaris Green Threads
GNU Portable Threads
One-to-One
maps each user thread to a kernel thread.
allows multiple threads to run in parallel on multiprocessors.
Examples:
Windows NT/XP/2000
Linux
Solaris 9 and later
Many-to-Many
Allows many user level threads to be mapped to many kernel threads.
Allows the operating system to create a sufficient number of kernel threads.
Data parallelism
Focuses on distributing subsets of the same data across multiple computing cores and performing the same operation on each core.