Полезная информация

next up previous contents
Next: Executing programs Up: Tour of the kernel Previous: How the kernel sees

Creating and destroying processes

A unix system creates a process though the fork() system call, and process termination is performed either by exit() or by receiving a signal. The implementation for them resides in kernel/fork.c and kernel/exit.c.

Forking is easy, and fork.c is short and ready understandable. Its main task is filling the data structure for the new process. Relevant steps, apart from filling fields, are

sys_fork() also manages file descriptors and inodes.

tex2html_wrap2943

Exiting from a process is trickier, because the parent process must be notified about any child who exits. Moreover, a process can exit by being kill()ed by another process (these are features). The file exit.c is therefore the home of sys_kill() and the vairious flavours of sys_wait(), in addition to sys_exit().

The code belonging to exit.c is not described here--it is not that interesting. It deals with a lot of details in order to leave the system in a consistent state. The POSIX standard, then, is quite demanding about signals, and it must be dealt with.



Converted on:
Mon Apr 1 10:20:16 EST 1996