Thread models

There are different models of thread usage: user threads and kernel threads.

In the user thread model, all program threads share the same process thread. In the user thread model, the thread application programming interfaces (APIs) enforce the scheduling policy and decide when a new thread runs. The scheduling policy allows only one thread to be actively running in the process at a time. The operating system kernel is only aware of a single task in the process.

In the kernel thread model, kernel threads are separate tasks that are associated with a process. The kernel thread model uses a preemptive scheduling policy in which the operating system decides which thread is eligible to share the processor. In a kernel thread model, there is a one-to-one mapping between program threads and process threads. The IBM® i operating system supports a kernel thread model.

Some platforms support a combination of these two thread models, commonly referred to as an MxN thread model. Each process has M user threads that share N kernel threads. The user threads are scheduled on top of the kernel threads. The system allocates resources only to the more "expensive" kernel threads.