Operating Systems
What this domain tests
Operating Systems tests how a machine multiplexes processes, memory, and files. Expect process/thread differences, scheduling, synchronization, deadlock, paging, virtual memory, and permissions.
Core rules and concepts
- A process has its own address space; threads share code, data, and open files but have separate stacks and registers.
- Scheduling metrics include waiting time, turnaround time, and response time. FCFS can cause convoy effects; SJF minimizes average waiting but needs burst estimates; round robin bounds response time.
- A race condition occurs when output depends on interleaving. A mutex gives mutual exclusion; a semaphore counts resources.
- Deadlock requires mutual exclusion, hold-and-wait, no preemption, and circular wait. Breaking any one prevents it.
- Paging divides memory into fixed frames; a page fault loads a page. Thrashing is excessive paging, often from overcommitting memory.
Worked example
Round robin, quantum 4: P1 burst 8, P2 burst 4, P3 burst 2, all arrive at 0. Order: P1 0–4, P2 4–8, P3 8–10, P1 10–14. Waiting times: P1 waits 6 (4–10), P2 waits 4 (0–4), P3 waits 8 (0–8). Average = (6+4+8)/3 = 6. P1 is preempted at 4, so its remaining 4 runs after P3.
Traps that cost marks
Treating threads as having separate address spaces. Calling starvation deadlock. Assuming more RAM always stops thrashing. Confusing paging with segmentation. Forgetting that a semaphore can allow more than one holder when its count exceeds 1.