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.
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 | 2 | Simultaneous execution capacity | |
| Connections | 1,000 | Open client resources | |
| Ready connections | 20 | Descriptors with work now | |
| Idle connections | 980 | Descriptors waiting for readiness | |
| Page size | 4,096 bytes | Virtual-memory offset size | |
| Descriptor limit | 1,024 | Per-process open-file ceiling | |
| Reserved descriptors | 24 | Listener, logs and other declared resources | |
| Container quota | 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.
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.
- 01OS fundamentalsSections 1 to 4. An operating system turns shared hardware into controlled resources for programs.
- 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.
- 03Fork, exec and threadsSections 9 to 12. A shell needs a way to create a child without losing its own prompt.
- 04Concurrency and synchronizationSections 13 to 16. Two workers can read the same counter and erase one another's update.
- 05Deadlocks and resource safetySections 17 to 21. A blocked task can hold exactly the resource another task needs.
- 06CPU schedulingSections 22 to 25. The scheduler decides which ready work gets a core and when a timer can take it back.
- 07Paging and virtual memorySections 26 to 31. A virtual address is a name whose physical location can change.
- 08Copy-on-write and mappingsSections 32 to 35. Process creation, file loading and allocation all use virtual mappings.
- 09FilesystemsSections 36 to 39. A file name is not the file bytes.
- 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.
- 11Protection, containers and LinuxSections 45 to 49. Security begins with identity and page permissions, then extends to virtual machines, namespaces and cgroups.
- 12The complete server traceSections 50 to 56. A program becomes a server through process creation, address translation, scheduling, descriptors, readiness, files and resource limits.
- +Interview prepInterview question bank, graded exercises and worked solutions.