Technology news and Jobs
The Linux distillery
Processed Linux: from exec to exit
The Linux distillery
Processed Linux: from exec to exit | Processed Linux: from exec to exit |
|
|
|
| by David M Williams | |
| Monday, 03 March 2008 | |
|
Page 1 of 3 Linux enforces strong family values through parent/child relationships. Every single process except for one has a parent process. The one exception is init which is the granddaddy of everything else. This is process number 1, the big kahuna which fires when Linux first boots. Every other process has been spawned from it, either directly or through its offspring. Like some types of worms and fish, Linux processes have only one parent. And, like guinea pigs and rabbits, a Linux process can have almost any number of children. Users of a Linux system create processes when they execute command-line instructions or when they double-click on icons and menu options within the GUI environment. Behind the scenes, the applications invoked come to life because they are spawned by a parent process – whether it be a BASH shell, for instance, or the KDE or Gnome desktop. And, if a program creates another task then it is making a child process of its own. This happens all the time. It’s what Apache does when a web page request comes in, for example. Apache spawns a new process to take care of the incoming connection so the main body of the program is freed up instantly and can listen for new incoming requests. If it didn’t spawn off a child process, the web server may become unusable by others because its time is taken up serving the first request instead of responding to newcomers. Behind the scenes, these processes are made through one of but three system calls within the Linux kernel. Two of these have a shared UNIX heritage, fork and vfork, whereas the third one is specific to Linux and is called clone. fork is the historically preferred way to create new processes. The fork system call splits the process in two, leaving a parent and a child process. The parent is the original process, retaining the process ID it had since it began, and receiving the process ID of the child as a return value from fork. The child process, however, is a duplicate running in a new process space with a new process ID. It receives a value of 0 as the return value from fork. It’s this return value which lets program code determine if it is the parent or child process once the split has taken place and respond in whatever manner is appropriate for that specific application. Please read on for more cytokinesis! CONTINUED |
| < Next story in category | Previous story in the category > |
|---|










