Kernel process

From Computer History Wiki
Jump to: navigation, search

A kernel process (similar terms/concepts system process, kernel thread, kernel task, etc) refers to the use of the basic primitives provided by the kernel for user computations to perform its own functions.

This can make kernel code significantly simpler (and easier to write, understand, etc).

History

In addition to 'standard' daemons (e.g. the line printer spooler daemon, email daemon, etc, etc) there are some other things that are daemon-like, but are fundamentally different in major ways.

Early UNIX is one of the first systems to have one (process 0, the "scheduling (swapping) process"). The considerably later Berkeley UNIX also has one, mentioned in "Design and Implementation of the Berkeley Virtual Memory Extensions to the UNIX Operating System" (below), where it is called the "pageout daemon":

"During system initialization, just before the init process is created, the bootstrapping code creates process 2 which is known as the pageout daemon. It is this process that .. writ[es] back modified pages. The process leaves its normal dormant state upon being waken up due to the memory free list size dropping below an upper threshold."

Typical daemons look (to the kernel) just like 'normal' processes: their object code is kept in a file, and is loaded into the daemon's process when it starts, using the same mechanism that 'normal' processes use for loading their code; daemons are often started long after the kernel itself is started, and there is usually not a special mechanism in the kernel to start daemons (on early UNIXes, /etc/rc is run by the 'init' process, not the kernel); daemons interact with the kernel through system calls, just like 'ordinary' processes; the daemon's process runs in 'user' CPU mode (using the same standard memory management mechanisms as ordinary user processes).

'Kernel processes' do none of these things: their object code is linked into the monolithic kernel, and is thus loaded by the system bootstrap; the kernel contains special provision for starting the kernel process(es), which starts as the kernel is starting; it/they run in kernel mode, using the same memory mapping as the kernel itself; it/they don't do system calls, just call kernel routines directly; etc.

Another important point is that kernel processes are highly intertwined with the operation of the kernel; without the kernel process(es) operating correctly, the operation of the system will quickly grind to a halt. The loss of 'ordinary' daemons is usually not fatal; if the email daemon dies, the system will keep running indefinitely. Not so, for the swapping process, or the pageout daemon.

External links