CSS Prepare

optional · CSS study notes

P-II.III. Operating Systems Concepts

CSS Computer Science (Optional) — Paper-II, Section-A, Topic III. Index for Operating Systems Concepts — subtopics ordered to match the official syllabus sequence below. Four subtopics ("Structures, and Operations", "Design and Components of OS", "MLQ vs MLFQ" and "Threading") were missing from this vault and have been added. Where a topic's past-paper numericals are extensive, they're split onto their own linked subpage so the concepts stay quick to revise on their own.

🧮 Deep-Dive Numerical Subpages (extra worked practice, indexed here too)

These also sit under their parent topic above — listed here too so they're one click from this index instead of buried inside a subpage.

Process Management →

Memory Management →

Virtual Memory Management →


📊 Past-Paper Weightage (Operating Systems-tagged marks, subjective questions, per year)

YearOS marks (Paper-II)Heaviest subtopic that year
201620Deadlocks (Banker's Algorithm), Process Management (PCB/scheduling)
201745Virtual Memory (Optimal vs LRU), Deadlocks, Process Management, File Systems
201825Deadlocks (RAG), Memory Management (paging), I/O Management (polling/interrupts)
201920Virtual Memory (swapping), Process Management, File Systems
202026OS Structures (kernel), Virtual Memory (TLB), Deadlocks, File Systems
202140Memory Management (bitmap, 20 marks), Virtual Memory (EMAT), Deadlocks (RAG), Process Sync (race condition)
202240Deadlocks (Banker's, 12 marks), Process Management (Gantt chart, 10 marks), I/O (C-SCAN)
202318I/O Management (buffering proof, scheduling favoritism)
202426+ (plus MCQs)Design/Components (security, malware), File Systems (UNIX vs Windows), Process Management
202520+ (plus MCQs)Process Synchronization (producer-consumer), Virtual Memory (multi-level paging)

Takeaway: Deadlocks and Virtual/Memory Management together account for the largest and most consistent share of marks almost every year — prioritize their worked-numericals subpages first if time is short. Process Management and Process Synchronization are the next tier; Classification, Computing Environments, and OS Structures appear more as short-note/MCQ material than long numericals.


✅ Self-Test Questions (with Answers)

Q1. List the four Coffman conditions necessary for deadlock to occur, and explain how denying "hold and wait" prevents it.

Ans: (1) Mutual exclusion — at least one resource is non-sharable; (2) Hold and wait — a process holding a resource waits for another; (3) No preemption — a resource can only be released voluntarily; (4) Circular wait — a closed chain P₁→P₂→…→P₁ in which each waits for the next. All four must hold simultaneously. Denying hold and wait means a process must request all its resources at once before starting (or release everything it holds before requesting more), so it never holds one resource while waiting for another and the chain cannot form. Cost: low resource utilisation (resources are reserved long before use) and possible starvation of processes needing many popular resources.

Q2. Distinguish paging from segmentation as memory management techniques.

Ans: Paging divides memory into fixed-size frames/pages (e.g., 4 KB); the division is invisible to the programmer; the address is (page number, offset); it suffers internal fragmentation but no external fragmentation, and uses a page table. Segmentation divides memory into variable-size logical units that match the program's structure (code, data, stack, functions); the address is (segment number, offset); it supports protection and sharing at the logical level but suffers external fragmentation and needs base/limit values in a segment table. Many systems combine them (segmented paging).

Q3. Compare FIFO, LRU, and Optimal page replacement algorithms — which can suffer Belady's Anomaly?

Ans: FIFO replaces the oldest loaded page — simple but ignores usage. LRU replaces the page unused for the longest time — good approximation of behaviour, but costly (counters or stack; usually approximated by the clock/second-chance algorithm). Optimal (OPT/MIN) replaces the page that will not be used for the longest time in future — gives the fewest faults but is unimplementable, so it serves as a benchmark. Belady's Anomaly (more frames → more page faults) can occur in FIFO (and in second-chance); LRU and OPT are stack algorithms and never suffer it.

Q4. What is thrashing, and what typically causes it?

Ans: Thrashing is a state in which the system spends more time swapping pages in and out than executing instructions; CPU utilisation collapses while disk activity peaks. Cause: the degree of multiprogramming is too high, so each process gets fewer frames than its working set; every process page-faults constantly, the CPU appears idle, the long-term scheduler admits more processes and the situation worsens. Remedies: the working-set model, page-fault frequency (PFF) control, reducing the degree of multiprogramming (suspending processes), local replacement policies, and adding physical memory.

Q5. Explain the difference between a mutex/binary semaphore and a counting semaphore.

Ans: A binary semaphore/mutex takes only the values 0 and 1 and enforces mutual exclusion over a single resource or critical section; a mutex additionally has the notion of ownership — only the thread that locked it may unlock it. A counting semaphore takes any non-negative integer, initialised to the number of identical available instances of a resource (e.g., 5 printers); wait() decrements and blocks at 0, signal() increments and wakes a waiter. In short: mutex/binary = lock for one resource; counting = resource counter for many instances (also used for producer-consumer buffer slots).

Q6. A resource-allocation graph contains a cycle. Under what condition is this NOT sufficient to conclude deadlock?

Ans: When some resource types have multiple instances. With one instance per type, a cycle is necessary and sufficient for deadlock. With multiple instances a cycle is only necessary, not sufficient — another process may still release an instance of a resource in the cycle and break it. In that case the graph must be tested with a reduction/safety algorithm (the Banker's algorithm or a wait-for-graph reduction) to decide whether the state is actually deadlocked.

Q7. Differentiate between a monolithic kernel and a microkernel, with one example of each.

Ans: A monolithic kernel places all core services — scheduling, memory management, file systems, device drivers, IPC — in a single address space in kernel mode. It is fast (service calls are ordinary function calls) but large, harder to maintain, and a driver bug can crash the whole system. Example: Linux (also traditional UNIX). A microkernel keeps only the essentials in kernel mode (IPC, basic scheduling, minimal memory management) and runs file systems, drivers and other services as user-space processes communicating by message passing. It is more reliable, secure and extensible, but slower because of message-passing and mode-switch overhead. Example: Mach, QNX, MINIX (Windows NT and macOS are hybrids).

Q8. What is the purpose of a Translation Lookaside Buffer (TLB), and what happens on a TLB miss?

Ans: The TLB is a small, fast associative cache of recent page-table entries (page number → frame number). Without it, every memory reference would need at least two accesses — one for the page table, one for the data. On a TLB hit, the frame number comes straight from the TLB. On a TLB miss, the system walks the page table in memory (an extra access, or several with multi-level paging), loads that entry into the TLB (evicting an entry, often LRU), and restarts the reference; if the page is not in memory at all, a page fault follows. EMAT = h × (TLB + memory) + (1 − h) × (TLB + page-table access + memory).

Q9. Differentiate between the Scheduler and the Dispatcher.

Ans: The (short-term) scheduler is the decision maker: it applies the scheduling policy (FCFS, SJF, RR, priority) to select which ready process runs next. The dispatcher is the mechanism that carries the decision out: it performs the context switch, switches to user mode and jumps to the correct location in the user program to restart it. The time the dispatcher takes is dispatch latency. A 2025 MCQ tested exactly this distinction.

Q10. Compare UNIX and Windows file systems in terms of permission model and metadata structure.

Ans:

AspectUNIX/Linux (ext4, UFS)Windows (NTFS)
Permission modelSimple rwx bits for owner / group / others (e.g., 755), plus setuid, setgid and sticky bits; optional POSIX ACLsFull Access Control Lists: per-user and per-group entries with fine-grained rights (read, write, execute, delete, take ownership), allow and deny entries, inheritance
Metadata structureinode per file holding type, permissions, owner, timestamps, size and block pointers (direct, single/double/triple indirect); the name lives only in the directory entryMaster File Table (MFT) record per file; everything, including data of small files, is an attribute; supports journaling, compression, encryption (EFS) and alternate data streams
NamespaceSingle hierarchy rooted at /, other devices mounted into it; case-sensitivePer-volume drive letters (C:, D:); case-insensitive (case-preserving)
LinksHard links and symbolic linksHard links, junctions and symbolic links

Continue studying