TRT
Sign in

Advanced · Module 6 · Lesson 1 of 10

Process Lifecycle: fork, execve, and Address Space Duplication

Spawn isolated process address spaces with fork, trace Copy-on-Write memory mechanics, replace process images using execve, and control descriptor inheritance.

Pro — members onlyAbout 16 minutes

By the end you can

  • Trace dual execution branches using the distinct return values of fork
  • Inspect how the CPU Memory Management Unit implements Copy-on-Write (COW) page sharing
  • Replace calling process memory images atomically with new binaries using execve
  • Construct null-terminated argument and environment vectors for executable loading

Builds on Memory-Mapped I/O with mmap and msync.

01 · A question first

Why does fork() return once in the parent process but return a second time in the child, even though you only called it once? And why does cloning a process consuming 32 gigabytes of RAM execute in less than a millisecond without exhausting system memory?

Make a guess before you read on.

02 · The idea

Members only

Unlock the full lesson

This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.

What's inside

  • Start with the problem
  • How the idea works
  • Why it is correct
  • What it costs
  • Pitfalls and variations
  • Where it is used

03 · Practice

Something wrong with this lesson? Report a problem