Operating Systems Semester Guide: Learn Theory, Solve Numericals and Practise Labs
Connect OS concepts to semester calculations and programs through scheduling, Banker's Algorithm, paging, storage, and five lab checks.
KnowledgeGate Team
Exam prep & CS education

Semester papers turn process states and paging into timelines and address calculations; labs require the same logic to run as code. Use CS Fundamentals for the wider syllabus, treat your university's current syllabus as authoritative, and organise work into processes, synchronization, memory, storage and laboratory checks.
1. Build the semester map before opening a chapter
Study in dependency order: OS role, kernel and system calls; process states; CPU scheduling; threads and synchronization; deadlocks; memory and virtual memory; then file systems and disk scheduling. Each step supplies concepts needed by the next.
Make a three-column map before detailed study:
Topic | Theory question | Numerical | Lab proof |
|---|---|---|---|
CPU scheduling | Preemption and convoy effect | Gantt chart | Scheduler simulator |
Paging | Page-table translation | Logical to physical address | FIFO/LRU program |
Deadlock | Safe and unsafe states | Banker's Algorithm | Safety check |
This map keeps theory, calculations and code connected. Operating Systems for GATE is a competitive-exam route, not a substitute for your university syllabus.
2. Processes and CPU scheduling: turn a process table into a timeline
A process moves through new, ready, running, waiting and terminated states. Record arrival (AT), CPU burst (BT) and preemption. Calculate turnaround = completion - arrival, waiting = turnaround - burst, and response = first run - arrival. Response covers only the first service delay; waiting covers every ready interval.
For P1(AT=0, BT=5), P2(AT=1, BT=3), P3(AT=2, BT=1), and P4(AT=3, BT=2), FCFS gives:
P1 0-5 | P2 5-8 | P3 8-9 | P4 9-11
Completion times for P1 to P4 are 5, 8, 9, 11. Subtract arrivals to get turnaround times 5, 7, 7, 8; subtract bursts to get waiting times 0, 4, 6, 6.
Average turnaround is (5 + 7 + 7 + 8) / 4 = 6.75; average waiting is (0 + 4 + 6 + 6) / 4 = 4.00.
For Round Robin with quantum 2, enqueue boundary arrivals before the expired process:
P1 0-2 | P2 2-4 | P3 4-5 | P1 5-7 | P4 7-9 | P2 9-10 | P1 10-11
Completion is 11, 10, 5, 9, giving turnaround 11, 9, 3, 6 and waiting 6, 6, 2, 4. The averages are 7.25 turnaround and 4.50 waiting. Operating System Scenarios isolates the boundary-arrival rule on a three-process workload. Adding P4 here carries the convention into a simulator oracle shared by the numerical and lab sections.

3. Synchronization and deadlocks: trace ownership, not definitions alone
A race condition motivates the critical-section rules. Mutexes and semaphores control entry, but a process that holds one resource while requesting another can deadlock. The four necessary conditions are mutual exclusion, hold and wait, no preemption and circular wait. Do not stop at reciting them. Draw each allocation and request edge.
For a Banker's Algorithm snapshot with resources A, B, Available is (0,1):
Process | Allocation | Max | Need |
|---|---|---|---|
P0 | (1,0) | (2,1) | (1,1) |
P1 | (1,1) | (1,2) | (0,1) |
P2 | (1,1) | (2,2) | (1,1) |
Start with Work (0,1). P1 can finish, releasing (1,1), so Work becomes (1,2). Then P0 finishes and Work becomes (2,2). Finally, P2 finishes and Work becomes (3,3). The safe sequence is P1, P0, P2.
Suppose P2 requests (0,1). A provisional grant leaves Available (0,0) and changes P2's Need to (1,0). From Work (0,0), none of the unfinished processes can meet its Need. The provisional state is unsafe, so the request must wait. Deadlock in Operating Systems compares one grantable request with one unsafe request on a larger matrix. This smaller snapshot supplies one safe-sequence oracle and one rejection oracle for the lab check below.
4. Memory management: translate an address before replacing a page
Logical addresses belong to a process; physical addresses identify RAM locations. Pages and frames are fixed-size units. Paging avoids external fragmentation, although the final page can have internal fragmentation.
For a 16-bit logical address space and a 1 KB = 1024 bytes page, the offset needs log2(1024) = 10 bits. The remaining 16 - 10 = 6 bits hold the page number. For logical address 5000:
Page number =
floor(5000 / 1024) = 4.Offset =
5000 mod 1024 = 904.If page-table entry
page 4 -> frame 12, physical address =12 x 1024 + 904 = 12,288 + 904 = 13,192.
Next, test replacement with three empty frames and reference string 7, 0, 1, 2, 0, 3, 0, 4. FIFO faults on seven references. LRU keeps the recently used 0 and faults six times. A lab program should print all three frames after every reference. A correct final count must not hide a wrong intermediate replacement.

5. File systems and disk I/O: make storage calculations concrete
A directory maps names to file information; metadata records size and block locations. Compare contiguous, linked and indexed allocation with their free-space tracking. Logical and physical block numbers are not automatically identical.
An 18 KB file in 4 KB blocks needs ceil(18 / 4) = 5 data blocks. Four hold 16 KB; the last holds 2 KB and wastes 2 KB. Contiguous allocation might use 40-44. Indexed allocation could use index block 9, pointing to 40, 7, 62, 15, 88.
For cylinders 0-199, head 53, and queue 98, 183, 37, 122, 14, 124, 65, 67, FCFS moves 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640 cylinders. SSTF follows 53 -> 65 -> 67 -> 37 -> 14 -> 98 -> 122 -> 124 -> 183 and moves 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236. This lower movement does not guarantee fairness. For the same queue, File systems and disk scheduling in OS also computes SCAN and C-SCAN. Use the FCFS and SSTF totals here as fixed expected outputs for a semester lab and viva trace.
6. Turn the numericals into five laboratory checks
Build labs around known results:
Scheduler: reproduce both timelines; reject a non-positive quantum.
Mutex: run two 100,000-increment threads; expect 200,000 with protection and a nondeterministic unprotected result.
Safety check: return P1, P0, P2, reject P2's (0,1) request, and reject a negative Need.
Paging: reproduce FIFO 7, LRU 6 and address 5000 -> 13,192; reject zero frames.
Disk: reproduce FCFS 640 and SSTF 236; reject cylinders outside 0-199.
For each lab, preserve the input, trace, final metric and one invalid-input result. Keep a one-page record of the algorithm, test and observed mismatch for viva practice. Never hard-code expected output.
7. How semester papers test OS, and the traps that lose marks
There is no single official semester-paper pattern for every university. Map your current official university syllabus and latest official past paper into four broad forms: define or compare, draw and explain, trace an algorithm, and calculate a metric. Check the official documents for marks, unit weightage, prescribed experiments and dates.
Avoid these expensive errors:
Averaging completion time instead of waiting time.
Changing the Round Robin boundary convention midway.
Declaring deadlock from any wait instead of proving the required conditions.
Mixing a page number with a frame number, or counting a page-table lookup as a page fault.
Assuming SSTF is always fair.
Reporting only a lab's final number without its intermediate trace.
KnowledgeGate has about 2,000 Operating System questions in its practice bank for extra practice. That availability does not predict any university paper's content or weightage. After the semester, use the GATE sequence for competitive revision.
8. The short version and the next step
Use one repeatable loop: learn the state or data structure, solve a trace by hand, implement the same trace, then explain one failure case aloud. Your checkpoints are FCFS average waiting 4.00, Banker's safe sequence P1, P0, P2, physical address 13,192, FIFO 7 faults and SSTF movement 236. Redo those calculations without looking, then run the matching lab inputs until each output is reproducible. For a semester-oriented path across core CS subjects, continue with Zero to Hero: Complete CS Course.
Keep learning

Critical Section in Process Synchronization: Race Conditions and Correctness Worked Step by Step
See how two sensible updates to x can finish at 6, 7, or 8. The worked trace connects race conditions to mutual exclusion, progress, bounded waiting, and safe synchronization choices.

System Calls and Dual Mode in OS: Mode-Bit Trace, Worked Example and Exam Traps
Follow one read() call across the user-kernel boundary, calculate its stated overhead, and learn the distinctions that make system-call questions easier.

Semaphores and Process Ordering in OS: P/V Traces, Worked Examples and GATE Traps
Learn one consistent semaphore convention, then trace ordering constraints, shared-variable updates, bounded-buffer permits, rendezvous, and deadlock step by step.

Round Robin Scheduling Explained: Gantt Charts, Waiting Time and GATE Traps
Learn a fixed Round Robin queue convention, trace staggered arrivals, calculate CT, TAT, WT and RT, and see how quantum size and context-switch cost change results.