PROCESS CREATION AND
PROGRAM EXECUTION
IN MORE DETAIL
This chapter extends the material presented in Chapters 24 to 27 by covering a vari-
ety of topics related to process creation and program execution. We describe process
accounting, a kernel feature that writes an accounting record for each process on the
system as it terminates. We then look at the Linux-specific clone() system call, which is
the low-level API that is used to create threads on Linux. We follow this with some
comparisons of the performance of fork(), vfork(), and clone(). We conclude with a
summary of the effects of fork() and exec() on the attributes of a process.
28.1 Process Accounting....................................................................................................
When process accounting is enabled, the kernel writes an accounting record to the
system-wide process accounting file as each process terminates. This accounting
record contains various information maintained by the kernel about the process,
including its termination status and how much CPU time it consumed. The
accounting file can be analyzed by standard tools (sa(8) summarizes information
from the accounting file, and lastcomm(1) lists information about previously exe-
cuted commands) or by tailored applications.