NSCT Operating Systems Revision Notes
These notes condense all 12 official Operating Systems topics into the definitions, formulas and numerical methods that most questions test: process states, CPU scheduling, synchronisation, deadlocks, paging, page replacement, file allocation, disk scheduling, I/O and protection. Operating Systems carries 5% of the NSCT, according to HEC's Areas of Competencies. It was also the weakest area in 2026: candidates averaged 33.8% accuracy, per the HEC NSCT report and APP.
That low average is good news for a prepared student. HEC's report shows accuracy of 49.5% on Understanding questions, 45.1% on Application and 44.8% on Analysis, and OS Application questions are mostly numericals with fixed procedures. Learn the procedure once, practise it a few times, and these become reliable marks.
How to use these notes: for every numerical, draw the chart or table on paper (a Gantt chart, a frame table, a Need matrix, a head-movement line) instead of working in your head. After each section, do its topic quiz through the link. Terms follow Silberschatz unless a note says otherwise.
Introduction to Operating Systems
- The OS is a resource allocator and a control program; the kernel is the one program running at all times.
- A program is passive; a process is a program in execution (one compiler, three users = 3 processes).
- A trap is a software-generated interrupt (error or system call). The interrupt vector holds handler addresses.
- Mode bit (Silberschatz): kernel = 0, user = 1. Privileged instructions in user mode trap to the OS.
- Hard real-time: a missed deadline is a failure (pacemaker). Soft real-time: occasional misses tolerated (streaming).
- CPU utilisation under multiprogramming = 1 − pⁿ.
Trap: a root program still runs in user mode; kernel mode is a CPU state, not an account. Practise: Introduction to Operating Systems MCQs for NSCT
Operating System Structures
- A system call traps into the kernel; programmers usually call an API, and
printf()is a library function that callswrite(). - Six categories: process control (
fork), file management (open), device management (ioctl), information maintenance (getpid), communications (pipe), protection (chmod). - Parameters go in registers, a memory block, or on the stack.
- Monolithic (UNIX, Linux): fast, but one driver bug can crash all. Linux is monolithic but modular.
- Microkernel (Mach, QNX): services in user space via messages; safer, slower. macOS/iOS (Darwin) and Windows are hybrids.
- Layered: each layer uses only those below it; layers are hard to define.
Trap: loadable modules do not make Linux a microkernel. Practise: Operating System Structures MCQs for NSCT
Process Management
- Five states: new, ready, running, waiting, terminated. Never waiting → running or ready → waiting.
- Schedulers: short-term (CPU), long-term (admits jobs), medium-term (swaps).
- The PCB holds state, PID, program counter, registers, scheduling, memory and I/O information, not the stack or heap contents.
- A context switch is pure overhead: 10 ms slice + 1 ms switch wastes 1/11.
fork()returns 0 in the child and the child's PID in the parent. n forks give 2ⁿ processes (2ⁿ − 1 children).fork() && fork()creates 3 processes. Zombie: dead child not yet reaped; orphan: parent gone.
Trap: when I/O completes, the process becomes ready, not running. Practise: Process Management MCQs for NSCT
CPU Scheduling
| Formula | Meaning |
|---|---|
| TAT = completion − arrival | Turnaround time |
| WT = TAT − burst | Time in the ready queue |
| Response = first run − arrival | Time to first service |
- FCFS: non-preemptive; convoy effect.
- SJF: minimum average waiting time; SRTF is its preemptive form.
- Priority: can starve; fix with aging. Check whether a low number means high priority.
- Round robin: FCFS plus a quantum; huge quantum = FCFS; better response, usually worse turnaround than SJF.
Trap: only SJF, SRTF and priority (without aging) can starve; FCFS and RR cannot. Practise: CPU Scheduling MCQs for NSCT and CPU scheduling numericals.
Thread Management
- Private to each thread: thread ID, program counter, registers, stack. Shared: code, data, heap, open files.
- Benefits: responsiveness, resource sharing, economy, scalability.
- User threads are cheap but invisible to the kernel; kernel threads can run on different cores.
- Many-to-one: one blocking call blocks all, no parallelism. One-to-one: Linux, Windows. Many-to-many: most flexible, hard to implement.
- Amdahl: speedup ≤ 1 / (S + (1 − S)/N), ceiling 1/S.
- POSIX
fork()copies only the calling thread.
Trap: 6 user threads on 3 kernel threads can run at most 3 at once. Practise: Thread Management MCQs for NSCT
Concurrency & Synchronization
- A race condition comes from
count++being load, add, store;count = 7with one ++ and one -- can end as 6, 7 or 8. - A critical-section solution needs mutual exclusion, progress and bounded waiting.
- Peterson's solution works for two processes but may fail on modern CPUs without memory barriers.
- Semaphore
wait()(P) decrements,signal()(V) increments. Mutual-exclusion semaphores start at 1; ordering semaphores start at 0. - A mutex has an owner; a semaphore does not. A monitor's
x.signal()with no waiter is lost.
Trap: in producer-consumer, wait(mutex) before wait(empty) deadlocks on a full buffer. Practise: Concurrency & Synchronization MCQs for NSCT and semaphores and classic problems.
Deadlocks
- Four Coffman conditions, all needed: mutual exclusion, hold and wait, no pre-emption, circular wait.
- Resource ordering breaks circular wait; requesting everything up front breaks hold and wait.
- RAG: a cycle means deadlock only with single-instance resources.
- Banker's: Need = Max − Allocation; find a process with Need ≤ Work, add its Allocation to Work, repeat. Cost O(m × n²).
- Unsafe ≠ deadlocked. Safe sequences are often not unique.
- n processes needing at most k units each cannot deadlock if total ≥ n(k − 1) + 1.
Trap: check a request against Need before Available. Practise: Deadlocks MCQs for NSCT and Banker's algorithm.
Memory Management
| Formula | Use |
|---|---|
| Physical = frame × page size + offset | Paging translation |
| EAT = h(TLB + mem) + (1 − h)(TLB + 2·mem) | With TLB (some editions ignore TLB time) |
| EAT = (1 − p) × mem + p × fault time | Demand paging |
| Segment: if offset < limit, base + offset | Else trap |
- First fit, best fit (smallest hole), worst fit (largest hole).
- Paging → internal fragmentation; segmentation and contiguous → external.
- FIFO, LRU, Optimal (fewest faults). Belady's anomaly affects FIFO, not LRU or Optimal.
- Thrashing: fewer frames than the working set; fix by running fewer processes.
Trap: 10 ms is 10,000,000 ns, not 10,000. Practise: Memory Management MCQs for NSCT, paging and address translation and page replacement.
File System Management
- The inode (file-control block) holds attributes and block pointers, not the name.
- Contiguous: fast, external fragmentation. Linked: no fragmentation, slow direct access. Indexed: direct access, wasted index block for tiny files. FAT is a linked variant.
- Inode max size = (direct + k + k² + k³) × B, where k = B / pointer size.
- Hard link: same inode, cannot cross file systems. Symbolic link: stores a path, can dangle.
- Bitmap size = blocks ÷ 8 bytes. UNIX 754 = rwxr-xr--.
Trap: reaching block i under linked allocation takes i reads. Practise: File System Management MCQs for NSCT
Secondary Storage Management
- Access time = seek + rotational latency (0.5 × 60 / RPM) + transfer.
- FCFS, SSTF (can starve), SCAN (to the end cylinder), C-SCAN (end, jump to 0), LOOK (reverse at last request), C-LOOK.
- Check the head's direction first; check whether the question counts the C-SCAN return seek.
- RAID 0: no redundancy. RAID 1: mirror. RAID 5: (n − 1) × c, survives 1. RAID 6: (n − 2) × c, survives any 2. RAID 10: n × c / 2.
- SSDs have no seek, so they usually get FCFS.
Trap: SCAN goes to the end cylinder; stopping at the last request is LOOK. Practise: Secondary Storage Management MCQs for the NSCT and disk scheduling.
Input / Output Systems
- Polling: CPU busy-waits on the status register; good for very fast devices.
- Interrupt-driven: one interrupt per byte or word; CPU share = interrupts per second × handler time.
- DMA: one interrupt per block; the CPU still sets up the transfer and loses some cycles (cycle stealing).
- Buffering reasons: speed mismatch, transfer-size mismatch, copy semantics. Double buffering runs at max(C, T).
- Caching keeps a copy; spooling queues whole jobs (printers).
Trap: nonblocking returns what is ready now; asynchronous completes later and notifies. Practise: Input / Output Systems MCQs for the NSCT
Protection & Security
- Access matrix: rows = domains, columns = objects. Special rights: copy (*), owner, switch, control.
- Access lists store columns (easy revocation); capability lists store rows (fast checks, hard revocation).
- UNIX permission classes are checked owner → group → others; only the first match applies.
- Authentication proves identity; authorisation sets rights. Salted slow hashes defeat precomputed tables.
- Threats: Trojan horse, trap door, logic bomb, buffer overflow, virus (needs host), worm (standalone), DoS.
Trap: a password plus a security question is still one factor. Practise: Protection & Security MCQs for the NSCT
Last-48-hours checklist
- Draw the five-state diagram and name the two forbidden transitions.
- Count processes for
fork(); fork(); fork();and forfork() && fork();. - Schedule one set of processes under FCFS, SJF, SRTF and RR with a Gantt chart.
- Compute average waiting and turnaround times from your chart.
- List what threads share and what each keeps private.
- Recite the three critical-section requirements.
- Set correct initial values for mutex, empty and full in producer-consumer.
- Recite the four Coffman conditions and what breaks each one.
- Run one Banker's safety check from Max, Allocation and Available.
- Translate one logical address to a physical address, in decimal and in hex.
- Compute one EAT with a TLB and one with page faults.
- Count page faults for FIFO, LRU and Optimal on one reference string.
- Trace SCAN and LOOK on one request queue.
- Compute an inode's maximum file size and a RAID 5 capacity.
- Reread your marked traps, then rest.
Most-tested comparisons
| Pair | Key difference |
|---|---|
| Program vs process | Passive file vs execution in progress |
| Process vs thread | Own address space vs shared address space, own stack |
| Monolithic vs microkernel | Services in kernel, fast vs user-space servers, safer |
| Preemptive vs non-preemptive | CPU can be taken away vs runs until burst ends or blocks |
| SJF vs SRTF | Non-preemptive vs preemptive shortest job |
| Mutex vs semaphore | Owner, locked/unlocked vs no owner, integer count |
| Deadlock vs starvation | Set stuck in a cycle vs one process never served |
| Prevention vs avoidance | Deny a condition by design vs check each request (Banker's) |
| Paging vs segmentation | Fixed, internal fragmentation vs variable, external |
| FIFO vs LRU | Evicts oldest loaded vs least recently used |
| SCAN vs LOOK | Reverses at end cylinder vs at last request |
| Hard link vs symbolic link | Same inode vs stored path |
| Access list vs capability list | Column per object vs row per domain |
Where to practise next
OS marks come from numericals, so spend most of your remaining time on the deep practice pages: CPU scheduling numericals, page replacement, Banker's algorithm, paging and address translation, disk scheduling and semaphores and classic problems. Keep the OS cheat sheet for quick reviews, return to the Operating Systems MCQs hub for any weak topic, and time yourself in the subject-wise mock tests.
FAQs
Why revise Operating Systems if it is only 5% of the test?
Because most candidates lost marks here. The 2026 average of 33.8% was the lowest of all 10 areas, so a student who can do the standard numericals reliably gains ground on most of the field. Our recommendation is 4 to 5 hours out of a 60-hour plan, slightly more than the weightage alone suggests.
Which OS numericals should I practise first?
Start with CPU scheduling (FCFS, SJF, SRTF, round robin) and page replacement (FIFO, LRU, Optimal), because they follow simple, repeatable procedures. Then do Banker's algorithm, address translation with a TLB, and disk scheduling. Always draw the chart or table, because most wrong answers come from skipping that step.
What if my textbook uses different conventions?
Textbooks differ on a few points: whether a lower priority number means higher priority, whether EAT includes TLB time, whether the C-SCAN return seek counts, and process state names. These notes follow Silberschatz and flag the differences. In the test, always apply the convention the question states.
Is there a PDF version of these OS notes?
There is no separate PDF of this page; it is designed to read well on a phone. For a printable summary, use the OS cheat sheet, which condenses the formulas, definitions and comparisons into a shorter format.
How do I avoid careless mistakes in OS numericals?
Write units next to every number and convert milliseconds to nanoseconds carefully. Draw a Gantt chart for scheduling, a frame table for page replacement and a Work column for Banker's. Before choosing an option, check the question's conventions on direction, priority order and preemption.
Next step
Start with the numericals: open CPU scheduling numericals and work three problems with Gantt charts. Then check your readiness across all 10 areas in a full NSCT mock test.