[OS] Threads 2
Updated:
Threads Part 2
Multithreading Models
- One-to-One
- Many-to-One
- Many-to-Many
One-to-One
- Each user-level thread maps to kernel thread
- Creating a user-level thread creates a kernel thread
- More concurrency than Many-to-One
- Number of threads per process sometimes restricted due to overhead
Many-to-One
- Many user-level threads mapped to single kernel thread
- Small and fast context switch between user threads
- One thread blocking causes all threads to block (kernel thread don’t care)
- Multiple threads may not run in parallel on a multicore system because only one may be in kernel at a time
- Few systems currently use this model
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
Two-level Model
- Similar to Many-to-Many, except that it also allows a user thread to be bound to kernel thread
Leave a comment