In a user kernel thread, a maximum of one task can use the processor, that is, be in the running state. All other tasks are either executable or waiting for an external event, such as the end of an I/O operation and a corresponding message, to become executable again.
If the current task no longer needs the processor, it triggers a task switch (cooperative task switch) and the next task in the same user kernel thread can use the processor.
The following graphic presents a simplified illustration of how three tasks in a user kernel thread run alternately.
Initially, task 1 is running, task 2 and task 3 are executable.
...
1. Task 1 sends an I/O request and puts itself in a waiting state.
Task 2 is the next executable task; it resumes executing.
2. Task 2 sends an I/O request and puts itself in a waiting state.
Task 3 is the next executable task; it resumes executing.
3. The I/O operation of task 1 is completed. Task 1 receives the respective message and is again executable.
4. Task 3 sends an I/O request and puts itself in a waiting state.
Task 1 is the next executable task; it resumes executing.
5. The I/O operation of task 2 is completed. Task 2 receives the respective message and is again executable.
6. Task 1 is completed.
Task 2 is the next executable task; it resumes executing.
See also: