C & Unix

fork and exec: How Processes Are Created

8:34

Plays from YouTube. Watch on YouTube

Why do parent and child processes see different values but sometimes share one file offset?

Meet fork and exec: How Processes Are Created: an original animated lesson in C and Unix systems programming.

We start with fork's return values, process IDs, unpredictable scheduling and independent virtual memory.

Then we investigate copy-on-write, inherited open file descriptions, exec replacement and correct child error handling.

The big idea: fork creates a separate execution; exec replaces its program image, with different inheritance rules for each resource.

C and Unix explained visually, one concept at a time.