What is the main purpose of the swapper process in Unix ?
Swapper process has the PID 0 and I guess it is the first process that loads. Can anyone throw more light on this topic or any references would be great .. Thanks..
feedback
|
It hasn't been a swapper process since the 1990s, and swapping hasn't really been used since the 1970s.Unices stopped using swapping a long time ago. They've been demand-paged operating systems for a few decades — since System V R2V5 and 4.0BSD. The swapper process, as was, used to perform process swap operations. It used to swap entire processes — including all of the kernel-space data structures for the process — out to disc and swap them back in again. It would be woken up, by the kernel, on a regular basis, and would scan the process table to determine what swapped-out-and-ready-to-run processes could be swapped in and what swapped-in-but-asleep processes could be swapped out. Any textbook on Unix from the 1980s will go into this in more detail, including the swap algorithm. But it's largely irrelevant to demand-paged Unices, even though they retained the old swap mechanism for several years. (The BSDs tried quite hard to avoid swapping, in favour of paging, for example.) Process #0 is the first process in the system, hand-crafted by the kernel. It Linux, traditionally, has been somewhat different to the Unices, in that process #0 is the idle process, running Even this is an out-of-date description. The late 1980s and early 1990s was the advent of multi-threading operating systems, as a result of which process #0 became simply the system process. In the world of old single-threaded Unices, one could only get a separate flow of execution to do a continuous kernel task by Along the way, several Unices fianlly lost the old swapper mechanism, that they were trying their utmost to avoid ever using anyway. OpenBSD's initialization code now simply drops into a So nowadays process #0 on a Unix is the system process, which effectively holds a number of kernel threads doing a number of things, ranging from page-out operations, through filesystem cache flushes and buffer zeroing, to idling when there's nothing else to run. | |||
|
feedback
|
|
process 0 is a special process (called swapper or idle process) which runs when system is idle ie. no other process is scheduled. It is the only process which can invoke idle() system call. This is the first process to be spawned, which then creates init (PID=1) process which starts other process. root 1 0 /sbin/init You can also check man idle | |||
|
feedback
|