Part 1 of 6 · 1 min read
Why this page comes sixth
In this module you will
- Translate a (segment, offset) address with a segment table, and say when it traps.
- Explain what the read, write and execute bits protect, and cause and read a segmentation fault.
- Show that a library is stored once in memory although many processes use it.
- Explain copy-on-write, and read its effect in the count of page faults.
- Explain why
forktakes milliseconds even for a large process.
Pages 3 to 5 built paging as a uniform mechanism: every page is the same size, and every entry has the same control bits. Programs, however, are made of parts with different rules: code that must not be changed, data that must, a stack that grows. This page shows the idea of segments, which expresses these parts, and how the per-page control bits of page 3 give the same protection in practice. It then shows two benefits of the mapping, sharing and copy-on-write. The sources are OSTEP chapters 16 and 18, OSC chapters 9 and 10, MOS chapter 3 and TLPI chapters 6 and 24. The programs were compiled with gcc -O0 -Wall -Wextra and run on a two-processor Linux machine.
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.