The Operating Systems sheet covers processes and threads, CPU scheduling, synchronisation and deadlock, virtual memory, file systems and I/O — the systems fundamentals interviewers use to separate a user of concurrency from someone who understands it.
The sheet holds 10 patterns and 50 topics, tracked row by row. From any row you can read the theory for a topic, answer knowledge-check questions on it, have the AI coach teach it back to you, keep notes, bookmark a row and mark it done. Progress is saved against your account, so the sheet is also the record of what you have already covered.
Who it is for
It is written for candidates facing a fundamentals round, and for backend and infrastructure engineers who debug latency, contention and memory behaviour in production.
How to work through it
For each topic, be able to state the problem it solves before the mechanism that solves it. A definition of a mutex earns nothing; explaining the race it prevents, and what it costs, is the answer being asked for.
Practice runs on the same platform as the sheet: 850+ problems across every track, code execution in 6 languages, and AI mock interviews that follow the pattern you are studying rather than a random question.
What the operating systems sheet covers
Interview Soon
6 patterns, 30 topics — the ones that come up first
What an Operating System Does — The Role of an Operating System, Kernel Mode, User Mode and Protection, System Calls, Interrupts, Traps and Exceptions, How Operating Systems Are Structured
Processes — What a Process Is, Process States and the Process Control Block, Creating and Terminating Processes, Context Switching, Inter-Process Communication
Threads and Concurrency — Threads and Why They Exist, Concurrency and Parallelism, Multithreading Models, Thread Pools and Common Thread Patterns, Thread Cancellation and Thread-Local Data
CPU Scheduling — Scheduling Basics and Criteria, First-Come First-Served and Shortest Job First, Round Robin and Time Slices, Priority and Multilevel Queue Scheduling, Multiprocessor Scheduling
Process Synchronization — Race Conditions and the Critical Section Problem, Locks and Mutexes, Semaphores, Classic Synchronization Problems, Monitors and Condition Variables
Deadlocks — What Deadlock Is and the Four Conditions, Resource Allocation Graphs, Deadlock Prevention, Deadlock Avoidance and the Banker's Algorithm, Deadlock Detection and Recovery
Deep Dive
4 patterns, 20 topics for full coverage
Main Memory — Address Binding and Logical vs Physical Addresses, Contiguous Allocation and Fragmentation, Paging, Page Tables and the TLB, Segmentation
Virtual Memory — Demand Paging and Page Faults, Page Replacement Algorithms, Frame Allocation and Thrashing, Copy-on-Write and Memory-Mapped Files, Kernel Memory Allocation
File Systems — Files, Attributes and Operations, Directories and Path Names, File Allocation Methods, Free Space Management and File System Implementation, Mounting, Protection and Sharing
Storage and I/O Systems — Disk Structure and Performance, Disk Scheduling Algorithms, RAID and Redundancy, I/O Hardware and Device Communication, The I/O Software Stack and Buffering
Reference: 40 questions
Last updated: September 1, 2026 · drawn from 239 operating systems knowledge-check questions, free on every plan.
What an Operating System Does
Name the three resource categories managed by an OS.
CPU, memory, and I/O devices.
Does calling `printf` immediately mean the program is in kernel mode?
No. `printf` is normally user-mode library code. It may later invoke a system call, which briefly enters kernel mode.
Who checks whether a file descriptor and pointer are valid?
The kernel checks them because user programs are not trusted.
A program executes an instruction requesting the kernel to read a file. What is this?
It is a trap because the program deliberately requested a system call.
Processes
A function returns. Which memory is automatically removed: its stack frame or every heap allocation it made?
Its stack frame is removed. Its heap allocations remain until explicitly released or until the process ends.
A keyboard read completes. What is the process’s next state?
Ready. The scheduler must select it before it runs.
A child calls `exec()` successfully. Does its PID change?
No. Its program changes, and it remains the same process with the same PID.
Does every system call cause a context switch?
No. Every system call enters the kernel, while the same process may be restored afterward.
Threads and Concurrency
Can Thread B read a heap object allocated by Thread A in the same process?
Yes. The heap is shared by the process’s threads.
Can a one-core machine provide parallelism for two tasks?
No. Parallel execution requires at least two cores for two tasks to execute at the same instant.
One user thread calls a blocking file `read` in a many-to-one system. What happens to the other user threads?
They stop because the only kernel thread is blocked.
What happens when all 10 workers are busy and request 11 arrives?
Request 11 enters the shared queue and waits for a worker to finish.
CPU Scheduling
A process waits for a disk from time 5 to time 9. Is that four milliseconds of ready-queue waiting?
No. It is four milliseconds of I/O blocking; ready-queue waiting occurs only when the process is ready but not running.
For bursts 6, 2, and 4 arriving together, what order does non-preemptive SJF choose?
It chooses 2, then 4, then 6.
A switch costs 0.1 ms and the quantum is 10 ms. What approximate percentage goes to switching?
\(0.1/(10+0.1)\times100\approx0.99\%\), or about 1%.
What does aging do?
It gradually increases the priority of a process while it waits, allowing it eventually to compete successfully.
Process Synchronization
What is the critical section in the counter example?
The load, addition, and store that together implement the increment.
What does test-and-set do for a lock?
It atomically reads the old lock value and sets the lock to held, so only one thread can observe that it changed the lock from free to held.
Why does a semaphore initialised to `0` enforce ordering?
A process that performs `wait` first blocks, and another process must perform `signal` before it can continue.
What does `full = 4` mean in a buffer of capacity 5?
Four items are available for consumers, and one slot is empty, so `empty = 1`.
Deadlocks
Which condition is removed when every thread acquires Lock A before Lock B?
Circular wait is removed.
Every resource type has one instance. The graph contains no cycle. Can the system be deadlocked?
No. With single-instance resources, deadlock requires a cycle.
Which prevention rule is normally used for multiple locks?
Assign a global rank and acquire locks in increasing rank order.
What is the remaining need of a process with maximum `(5,3,2)` and allocation `(2,1,0)`?
`(3,2,2)`.
Main Memory
Why can the program remain unchanged when it is loaded at a different location?
Its logical addresses remain the same; the relocation value changes, so the MMU produces different physical addresses.
Why can 900 KB of total free memory fail to satisfy a 300 KB request?
It can fail if every individual hole is smaller than 300 KB.
With 8-byte pages, how many offset bits are needed?
Three, because \(8 = 2^3\).
What does a TLB hit contain?
It contains a recent virtual-page-to-physical-frame translation, not the requested data.
Virtual Memory
Who detects an invalid page-table entry, and who loads the page?
The hardware detects it and raises the trap; the operating system loads the page.
Which page does optimal replacement evict?
The resident page whose next use is farthest in the future, including a page that will never be used again.
Processes use 4, 8, and 12 pages, and 12 frames are available. How many frames does proportional allocation give them?
2, 4, and 6 frames, because their sizes are in the ratio \(4:8:12\).
Who detects a write to a read-only COW page?
The memory-management hardware detects the permission violation and raises a page fault; the operating system handles it.
File Systems
What does seek change?
It changes the current position; it does not read or modify file data by itself.
A directory entry points to FCB 70. What does removing that entry do?
It removes one name-to-FCB mapping and decreases FCB 70's link count by 1.
Why does a file with blocks at 3, 9, and 15 require a chain for linked allocation?
The blocks are not adjacent, so each block must identify where the next block is located.
Why can a linked list be poor at finding four consecutive blocks?
Its next pointer identifies another free block, not necessarily the physically adjacent block.
Storage and I/O Systems
At 7,200 rpm, what is the average rotational latency?
One revolution is about 8.33 ms, so the average wait is about 4.17 ms.
From head position 53, which request does SSTF choose first from the standard queue?
It chooses 65, because \(|65-53|=12\), which is smaller than the distance to every other pending request.
Given `A = 10`, `B = 12`, and `P = A XOR B = 6`, how is `B` recovered?
`B = A XOR P = 10 XOR 6 = 12`.
Why can polling waste CPU time?
The CPU repeatedly checks an unchanged status value instead of running other work.
Limited time — 15% off all plans & roadmaps Use code