Summary

When process accounting is enabled, the kernel writes an accounting record to a file for each process that terminates on the system. This record contains statistics on the resources used by the process.

Like fork(), the Linux-specific clone() system call creates a new process, but allows finer control over which attributes are shared between the parent and child. This system call is used primarily for implementing threading libraries.

We compared the speed of process creation using fork(), vfork(), and clone(). Although vfork() is faster than fork(), the time difference between these system calls is small by comparison with the time required for a child process to do a subsequent exec().

When a child process is created via fork(), it inherits copies of (or in some cases shares) certain process attributes from its parent, while other process attributes are not inherited. For example, a child inherits copies of its parent’s file descriptor table and signal dispositions, but doesn’t inherit its parent’s interval timers, record locks, or set of pending signals. Correspondingly, when a process performs an exec(), certain process attributes remain unchanged, while others are reset to defaults. For example, the process ID remains the same, file descriptors remain open (unless marked close-on-exec), interval timers are preserved, and pending signals remain pending, but handled signals are reset to their default disposition and shared memory segments are detached.

Refer to the sources of further information listed in Section 24.6. Chapter 17 of [Frisch, 2002] describes the administration of process accounting, as well as some of the variations across UNIX implementations. [Bovet & Cesati, 2005] describes the implementation of the clone() system call.