In a user kernel thread, a maximum of one task can use the processor, that is, be running. All other tasks can either run or are waiting for an external event, such as the end of an I/O operation and a corresponding message so that they can run again.
The change between the tasks is known as task switching. Task switching in a user kernel thread always takes place cooperatively, that is, it is triggered by the task that is currently running.
The following figure shows a simplified overview of how three tasks are executed alternately in a user kernel thread.
At the beginning, task 1 is running, and task 2 and task 3 can run.
...
1. Task 1 triggers an I/O request and assumes a waiting state. Task 2 is the next task that can run and continues its processing.
2. Task 2 triggers an I/O request and assumes a waiting state. Task 3 is the next task that can run and continues its processing.
3. The I/O operation of task 1 is completed. Task 1 receives a completion message and can run again.
4. Task 3 triggers an I/O request and assumes a waiting state. Task 1 is the next task that can run and continues its processing.
5. The I/O operation of task 2 is completed. Task 2 receives a completion message and can run again.
6. Task 1 is completed. Task 2 is the next task that can run and continues its processing.
See also: