When you call a system call such as fork
in process X, the kernel is said to be executing in process context. So, fork
can be said to be running in pro
It really depends upon where the schedule()
call is made from; schedule()
can be called both from process context or from a work queue. The work queues are kernel-scheduled threads:
# ps auxw | grep worker
root 1378 0.0 0.0 0 0 ? S 20:45 0:00 [kworker/1:0]
root 1382 0.0 0.0 0 0 ? S 20:45 0:00 [kworker/2:0]
root 1384 0.0 0.0 0 0 ? S 20:45 0:00 [kworker/3:1]
...
The [..]
signifies that the processes do not execute in userspace.
The worker_thread()
function calls schedule()
after handling a work item but before starting all over again.
schedule()
can also be called on behalf of a process, either by a driver or by signal handling code, or filesystem internals, or myriad other options.