CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 1 of 6 · 1 min read

Why this page comes last in Level 1

In this module you will

  • Explain what a zombie process is, why it exists and how to remove it.
  • Explain what happens to the children of a parent that ends first.
  • Reap children with a SIGCHLD handler and waitpid with WNOHANG.
  • Write a classic daemon with a double fork and setsid.
  • Read the family tree of processes and name what the first process does with orphans.

Page 3 showed that wait collects a child's exit status, and page 6 introduced SIGCHLD. This page covers what goes wrong when wait is missing, when a parent ends first, and how Unix starts services that run in the background (Level 0, page 4 named them daemons). It also closes the cycle of a process's life: creation (page 3), running and switching (pages 2 and 5), and ending (this page). The main sources are "The Linux Programming Interface" (TLPI), chapters 26 and 37, "Operating System Concepts" (OSC), chapter 3, and "Operating Systems: Three Easy Pieces" (OSTEP), chapter 5. Every program was compiled with -Wall -Wextra and run.

About this example About this example

Real: The C programs, commands and outputs on this page were compiled with gcc -Wall -Wextra -pthread and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39).

Scripted: The worked traces use small numbers chosen so they can be followed by hand.

Not real: The page simplifies real systems. Actual kernels add more cases, limits and tuning than a short page can show.