Operating Systems
What this domain tests
Operating Systems questions cover process management and scheduling, synchronisation and deadlock, memory management including virtual memory, and file systems with basic Linux commands.
Process states and scheduling
A process moves through new, ready, running, waiting and terminated states; a context switch saves its process control block and restores another. Turnaround time = completion minus arrival; waiting time = turnaround minus burst time. FCFS suffers the convoy effect, SJF gives the minimum average waiting time but needs burst prediction, round robin depends on the time quantum, and priority scheduling risks starvation, cured by aging.
Deadlock and memory management
All four Coffman conditions must hold together: mutual exclusion, hold and wait, no preemption and circular wait. Banker's algorithm is deadlock avoidance, not detection. Paging removes external fragmentation but leaves internal fragmentation in the last page; the TLB caches page-table entries. FIFO page replacement can show Belady's anomaly; LRU is a stack algorithm and cannot. Thrashing is excessive paging because the working set does not fit in memory.
Worked example
Burst times P1 = 6, P2 = 8, P3 = 7, P4 = 3, all arriving at time 0, using SJF. Order: P4 (0 to 3), P1 (3 to 9), P3 (9 to 16), P2 (16 to 24). Waiting times are 0, 3, 9 and 16, totalling 28, so the average is 7 ms. Under FCFS in the given order the waiting times are 0, 6, 14 and 21, averaging 10.25 ms, which shows why SJF is optimal for average waiting time.
Traps that cost marks
- Applying SJF formulas when arrival times differ and forgetting idle CPU time.
- Calling Banker's algorithm a detection method.
- Blaming Belady's anomaly on LRU instead of FIFO.
- Mixing internal and external fragmentation.