Highlights

Contents

FUNDAMENTALS / CHAPTER 3 / FIELD GUIDEOperatingsystemsA hand-drawn field guide to processes, memory, files and I/OCPUcodeheapstackThe machine behind your programA core, private address spaces and persistent bytesapplicationprogram and serversystem callsthe controlled boundarykernelresource decisionshardwarecores, memory and devices
Before we start

How to read this chapter

A college admissions server waits on many students’ connections while only a few need work. This guide explains how processes, scheduling, memory, I/O, and limits turn that waiting into useful service.

Read in order to follow the complete mechanism, or use the contents for revision. After each drawing, explain what changes, what remains protected, and what could fail. The orange map locates the current part.

Each part ends with an “In one breath” recap. The interview page has short questions, graded reasoning exercises, and worked solutions. Explain the assumptions before consulting a formula.

The running example

Meet Finch’s admissions server

Finch’s server is an illustrative Linux-like college admissions service in Bengaluru. It has two cores and 1,000 connections, with 20 ready and 980 idle. These are teaching inputs, not measured portal traffic.

Setting Symbol or resource Value What it controls
CPU cores CC 2 Simultaneous execution capacity
Connections NN 1,000 Open client resources
Ready connections RR 20 Descriptors with work now
Idle connections II 980 Descriptors waiting for readiness
Page size PP 4,096 bytes Virtual-memory offset size
Descriptor limit LL 1,024 Per-process open-file ceiling
Reserved descriptors QQ 24 Listener, logs and other declared resources
Container quota qq 50 ms per 100 ms CPU allocation

The shared fixture is in src/data/fundamentals/os-numbers.json. Its script, scripts/fundamentals/os-numbers.py, checks the illustrative traces. Keep CPU execution, socket readiness, memory residency, and resource quotas distinct.

The map

What is inside

Read in order for the complete mechanism, or use the contents to revise one topic. Each part marks its place in the same application to hardware map.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1OS fundamentals2Processes3Fork, exec and threads4Synchronization5Deadlocks6CPU scheduling7Paging and memory8Copy-on-write9Filesystems10I/O and IPC11Protection and Linux12Complete server trace
  1. 01OS fundamentalsSections 1 to 4. An operating system turns shared hardware into controlled resources for programs.
  2. 02Processes and system callsSections 5 to 8. A process is the OS's record of one executing program image, not merely a file on disk.
  3. 03Fork, exec and threadsSections 9 to 12. A shell needs a way to create a child without losing its own prompt.
  4. 04Concurrency and synchronizationSections 13 to 16. Two workers can read the same counter and erase one another's update.
  5. 05Deadlocks and resource safetySections 17 to 21. A blocked task can hold exactly the resource another task needs.
  6. 06CPU schedulingSections 22 to 25. The scheduler decides which ready work gets a core and when a timer can take it back.
  7. 07Paging and virtual memorySections 26 to 31. A virtual address is a name whose physical location can change.
  8. 08Copy-on-write and mappingsSections 32 to 35. Process creation, file loading and allocation all use virtual mappings.
  9. 09FilesystemsSections 36 to 39. A file name is not the file bytes.
  10. 10I/O, IPC and event loopsSections 40 to 44. Devices, files and sockets all make programs wait, but the wait can block a thread or return a readiness signal.
  11. 11Protection, containers and LinuxSections 45 to 49. Security begins with identity and page permissions, then extends to virtual machines, namespaces and cgroups.
  12. 12The complete server traceSections 50 to 56. A program becomes a server through process creation, address translation, scheduling, descriptors, readiness, files and resource limits.
  13. +Interview prepInterview question bank, graded exercises and worked solutions.