DSA Factory
Free What the OS does lessonsWhat the OS does · Stage 1 · Programs and processes · Step 3

Creating processes: fork and exec

How Unix makes a new process with fork(), runs a different program with exec(), and how to count what you get. About 14 minutes.

Quick check

A program calls fork() three times in a row and then prints a line. How many lines are printed?

  1. A8
  2. B3
  3. C4
Show the answer

8. Each fork doubles the processes: 1, 2, 4, 8. All of them reach the print.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve