Support for threads may be provided either at the user level, for user threads, or by the kernel, for kernel threads. User threads are supported above the kernel and are managed without kernel support, whereas kernel threads are supported and managed directly by the operating system. Accordingly, a relationship must exist between user threads and kernel threads.
One-to-one Model
The one-to-one model maps each user thread to a kernel thread.
Advantages | Provides more concurrency than the many-to-one model by allowing another thread to run when a thread makes a blocking system call. |
Limitations | Every thread operation must go through the kernel; slower performance. |
One-size fits all thread implementation; maybe pay for fancy features that a thread doesn’t need. | |
General heavy-weight memory requirements (e.g., requires a fixed-size stack within kernel). |
Many-to-one Model
The many-to-one model maps many user-level threads to one kernel thread.
Advantages | Thread scheduling is done in user space, so it is efficient. |
Limitations | Can’t take advantage of multicore systems. |
User-level threads are invisible to the OS and thus not well-integrated with the OS. | |
As a result, the OS can make poor decisions (e.g., a blocking system call blocks all threads) |
Many-to-many Model
The many-to-many model multiplexes many user-level threads to a smaller or equal number of kernel threads. This is sometimes also called n:m thread model, where n is the number of user threads, and m is the number of kernel threads.