SYSTEM SOFTWARE & OPERATING SYSTEM
UGC NET / JRF — Computer Science & Applications
High-Yield Study Notes & PYQ-Pattern Workbook (Unit 4)
Contents
Beginner → Concept → NET-level → JRF-level. Compact by design — exam value over page count.
Chapter 1 — Introduction to Operating System
1.1 What is an OS & its Functions
SimpleAn Operating System is software that sits between the user/applications and the hardware — it manages resources (CPU, memory, disk, devices) and provides a convenient interface to use the computer.
- Process management (creating, scheduling, terminating processes)
- Memory management (allocating/freeing memory)
- File management (organizing data on storage)
- I/O and device management
- Security and access control
1.2 Types of Operating Systems
| Type | Idea |
|---|---|
| Batch OS | Jobs collected and processed in groups, no user interaction during execution |
| Multiprogramming | Multiple jobs kept in memory; CPU switches between them to keep it busy (maximizes CPU utilization) |
| Multitasking / Time-sharing | CPU rapidly switches between processes giving the illusion of simultaneous execution to multiple interactive users |
| Real-time OS (RTOS) | Guarantees response within a strict time deadline (hard or soft real-time) |
| Distributed OS | Manages a group of independent networked computers, appearing as a single system |
JRF trap — multiprogramming vs multitaskingMultiprogramming's GOAL is maximizing CPU utilization (keep CPU busy by switching jobs when one waits for I/O) — it's not necessarily about fast response. Multitasking/time-sharing extends this specifically for FAST response to INTERACTIVE users via frequent switching. Every time-sharing system uses multiprogramming, but not vice versa — a common distinguishing question.
JRF trap — hard vs soft real-timeIn a HARD real-time system, missing a deadline is a total system failure (e.g., airbag deployment systems). In a SOFT real-time system, missing a deadline degrades quality but doesn't cause failure (e.g., video streaming — a dropped frame is tolerable).
1.3 OS Structures
| Structure | Idea |
|---|---|
| Monolithic | Entire OS (all services) runs as one large program in kernel mode — fast but hard to maintain/extend |
| Layered | OS organized into hierarchical layers, each built only on the layer below it — easier debugging/design |
| Microkernel | Only essential services (IPC, basic scheduling, memory) run in kernel mode; other services (file system, drivers) run in user mode as separate processes |
NET pointMicrokernel design improves RELIABILITY and SECURITY (a crashing service doesn't crash the whole kernel) at the cost of PERFORMANCE (more context switches/message passing between user-mode services and the kernel).
1.4 System Calls (Overview)
IdeaA system call is the programming interface through which a user program requests a service from the OS kernel (e.g., reading a file, creating a process) — it causes a switch from user mode to kernel mode.
| Category | Examples |
|---|---|
| Process control | fork(), exec(), exit(), wait() |
| File management | open(), read(), write(), close() |
| Device management | ioctl(), read(), write() |
| Information maintenance | getpid(), alarm(), sleep() |
| Communication | pipe(), shmget(), send(), recv() |
1.5 User Mode vs Kernel Mode
JRF trapA "mode bit" in hardware distinguishes User mode (restricted, 1) from Kernel mode (privileged, 0). Only in kernel mode can privileged instructions (direct hardware access, I/O instructions) execute. A system call causes a TRAP (software interrupt) that switches the mode bit to kernel mode — attempting a privileged instruction in user mode causes a trap/exception, not silent execution.
MUST REMEMBER — Chapter 1
- Multiprogramming: maximize CPU utilization. Time-sharing/Multitasking: fast response for interactive users (builds on multiprogramming).
- Hard real-time: missed deadline = failure. Soft real-time: missed deadline = degraded quality only.
- Monolithic = fast, hard to maintain. Microkernel = reliable/secure, slower (more IPC). Layered = modular, easier debugging.
- System call = user program requesting kernel service; switches user mode → kernel mode via a trap.
- Privileged instructions only run in kernel mode.
DON'T CONFUSE
- Multiprogramming (CPU utilization goal) vs Multitasking/Time-sharing (fast interactive response goal).
- Monolithic kernel (all-in-kernel, fast) vs Microkernel (minimal kernel, modular, slower).
JRF CHALLENGE ZONE — Chapter 1
1. The PRIMARY goal of multiprogramming is: (a) Fast response to users (b) Maximizing CPU utilization (c) Minimizing memory use (d) Real-time guarantees
Answer: (b)
Answer: (b)
2. A microkernel design mainly trades off: (a) Security for speed (b) Speed for reliability/modularity (c) Memory for CPU (d) Nothing, it has no trade-off
Answer: (b)
Answer: (b)
3. Missing a deadline in a hard real-time system results in: (a) Minor quality loss (b) Complete system failure (c) No effect (d) Automatic retry only
Answer: (b)
Answer: (b)
Practice Questions — Chapter 1 (7)
- What is the primary goal of multiprogramming?
Ans: Maximizing CPU utilization by switching to another job when one is waiting for I/O - Differentiate hard and soft real-time systems.
Ans: Hard: missing a deadline is a total failure; Soft: missing a deadline degrades quality but isn't catastrophic - What is the main advantage of a microkernel over a monolithic kernel?
Ans: Better reliability/security — a crashing service doesn't bring down the whole kernel - What is the main disadvantage of a microkernel compared to a monolithic kernel?
Ans: Lower performance due to more inter-process communication/context switches - What does a system call do, in terms of CPU mode?
Ans: It triggers a trap that switches the CPU from user mode to kernel mode to perform a privileged operation - Give two examples of process-control system calls.
Ans: Any two of: fork(), exec(), exit(), wait() - Why can't a privileged instruction run directly in user mode?
Ans: The hardware mode bit restricts privileged instructions to kernel mode; attempting one in user mode causes a trap/exception
Chapter 2 — Process Management
2.1 Process States & PCB
New → Ready → Running → Terminated
↑ ↓
Waiting (Blocked)
IdeaA process moves: New (created) → Ready (waiting for CPU) → Running (executing) → Waiting (blocked on I/O) → back to Ready → eventually Terminated. The PCB (Process Control Block) stores all info about a process: PID, state, program counter, registers, memory limits, scheduling info.
JRF trapA process moves from Running directly to Waiting (I/O request) or Terminated — but it CANNOT move directly from Running to Ready on its own; that only happens via a scheduler decision (e.g., time-slice expiry causes Running→Ready, an external event/interrupt).
2.2 CPU Scheduling Criteria
| Metric | Meaning |
|---|---|
| Waiting time | Time spent in the Ready queue |
| Turnaround time | Completion time − Arrival time (total time in system) |
| Response time | Time from arrival until FIRST response (not completion) |
| Throughput | Number of processes completed per unit time |
Turnaround Time = Completion Time − Arrival Time
Waiting Time = Turnaround Time − Burst Time
2.3 FCFS (First Come First Served)
Worked exampleProcesses P1(burst=5,arrival=0), P2(burst=3,arrival=1), P3(burst=8,arrival=2), FCFS order (by arrival):
P1: 0-5, P2: 5-8, P3: 8-16.
Waiting time: P1=0−0=0; P2=5−1=4; P3=8−2=6. Average waiting time = (0+4+6)/3 = 3.33.
Trap — Convoy effectFCFS suffers from the "convoy effect": a long process at the front makes all shorter processes behind it wait a long time, hurting average waiting time significantly — the classic weakness tested for FCFS.
2.4 SJF (Shortest Job First) & SRTF
IdeaSJF picks the process with the SHORTEST burst time next. It minimizes average waiting time among non-preemptive algorithms — but requires knowing burst times in advance (often estimated). SRTF (Shortest Remaining Time First) is the PREEMPTIVE version — if a new process arrives with a shorter remaining time than the currently running one, it preempts.
JRF-level numericalP1(arrival=0,burst=7), P2(arrival=2,burst=4), P3(arrival=4,burst=1), P4(arrival=5,burst=4), using SRTF:
0-2: P1 runs (remaining P1=5 at t=2). At t=2, P2(4) arrives — 4<5, so P2 preempts. 2-4: P2 runs (remaining P2=2 at t=4). At t=4, P3(1) arrives — 1<2, P3 preempts. 4-5: P3 runs to completion. At t=5, P4(4) arrives; compare remaining P2=2 vs P4=4 → P2(2) continues. 5-7: P2 completes. 7-11: P4 runs. 11-16: P1 (remaining 5) resumes and completes.
This exact "trace the preemption timeline" style is the hallmark JRF SRTF numerical.
TrapSJF/SRTF can cause STARVATION — a long process may never run if shorter jobs keep arriving. This is the tradeoff for SJF's optimality in average waiting time.
2.5 Round Robin (RR)
IdeaEach process gets a fixed time quantum in a cyclic queue; if not finished, it goes to the back of the queue. Designed for time-sharing/fair response, not minimum average waiting time.
JRF-level numericalP1(burst=10), P2(burst=5), P3(burst=8), quantum=4, all arrive at t=0 (RR order P1,P2,P3):
0-4:P1(rem6), 4-8:P2(rem1), 8-12:P3(rem4), 12-16:P1(rem2), 16-17:P2(rem0,done at t=17), 17-21:P3(rem0,done at t=21), 21-23:P1(rem0,done at t=23).
Turnaround: P1=23−0=23; P2=17−0=17; P3=21−0=21. Average = (23+17+21)/3 = 20.33.
NET pointSmaller quantum → better response time but MORE context-switch overhead. Larger quantum → RR degenerates toward FCFS behaviour. Choosing the "right" quantum is a classic conceptual tradeoff question.
2.6 Priority Scheduling
IdeaEach process is assigned a priority; the CPU is given to the highest-priority ready process. Can be preemptive or non-preemptive.
Trap — Starvation & AgingLow-priority processes may starve indefinitely if high-priority processes keep arriving. The fix is "Aging" — gradually increasing the priority of a process the longer it waits, eventually guaranteeing it runs.
2.7 Multilevel Queue & Multilevel Feedback Queue
IdeaMultilevel Queue: processes permanently classified into separate queues (e.g., system, interactive, batch) each with its own scheduling algorithm — no movement between queues. Multilevel FEEDBACK Queue: processes CAN move between queues based on behaviour (e.g., a CPU-bound process demoted to a lower-priority queue) — much more flexible.
MUST REMEMBER — Chapter 2
- Turnaround = Completion−Arrival; Waiting = Turnaround−Burst.
- FCFS suffers from the convoy effect (short jobs stuck behind long ones).
- SJF/SRTF minimize average waiting time but can cause starvation.
- Round Robin: fairness/response-time focus, not minimum average waiting time; quantum size is a key tradeoff.
- Priority scheduling can starve low-priority processes; Aging fixes this.
- Multilevel queue = fixed queue assignment; Multilevel FEEDBACK queue = processes can move between queues.
- Process cannot go Running→Ready by itself — only via scheduler/interrupt decision.
DON'T CONFUSE
- SJF (non-preemptive) vs SRTF (preemptive version of the same idea).
- Multilevel queue (fixed assignment) vs Multilevel feedback queue (processes can move).
- Waiting time vs Turnaround time vs Response time — three distinct metrics.
JRF CHALLENGE ZONE — Chapter 2
1. P1(arrival=0,burst=6), P2(arrival=1,burst=2), using SRTF. At t=1, remaining P1=5, P2=2 arrives. Since 2<5, P2 preempts. Find average waiting time.
Answer: 1-3: P2 runs, completes at 3 (waiting=3−1−2=0). 3-8: P1 resumes (had run 0-1, then 3-8=5 more, total 6), completes at 8 (waiting=8−0−6=2). Average=(0+2)/2=1.
Answer: 1-3: P2 runs, completes at 3 (waiting=3−1−2=0). 3-8: P1 resumes (had run 0-1, then 3-8=5 more, total 6), completes at 8 (waiting=8−0−6=2). Average=(0+2)/2=1.
2. What technique prevents starvation in priority scheduling? (a) Round robin only (b) Aging (c) FCFS conversion (d) Reducing quantum
Answer: (b)
Answer: (b)
3. Which is TRUE about Round Robin? (a) Minimizes average waiting time always (b) Is designed primarily for fair, responsive time-sharing (c) Never causes context-switch overhead (d) Is non-preemptive
Answer: (b)
Answer: (b)
Practice Questions — Chapter 2 (8)
- Write the formula for waiting time given turnaround time and burst time.
Ans: Waiting time = Turnaround time − Burst time - What is the "convoy effect" and which algorithm suffers from it?
Ans: Short processes get stuck waiting behind one long process; FCFS suffers from this - P1(burst=4,arrival=0), P2(burst=2,arrival=0), P3(burst=6,arrival=0) using FCFS order P1,P2,P3. Find average waiting time.
Ans: P1=0, P2=4, P3=6; average=(0+4+6)/3=3.33 - Why can SJF cause starvation?
Ans: A long process may be repeatedly postponed if shorter jobs keep arriving ahead of it - What is the tradeoff of choosing a very small time quantum in Round Robin?
Ans: Better response time but much higher context-switching overhead - What is "Aging" in priority scheduling?
Ans: Gradually increasing a waiting process's priority over time so it eventually runs, preventing starvation - Differentiate multilevel queue and multilevel feedback queue scheduling.
Ans: Multilevel queue has fixed queue assignment; multilevel feedback queue allows processes to move between queues based on behaviour - Can a process move directly from Running to Ready on its own?
Ans: No — that transition happens only via a scheduler decision (e.g., time-slice expiry)
Chapter 3 — Synchronization
3.1 Critical Section & Race Condition
SimpleA critical section is a code segment where a process accesses shared resources (variables, files) — if two processes execute their critical sections at the same time, the result depends on timing (a "race condition"), causing inconsistent/incorrect data.
Requirements for a critical-section solutionMutual Exclusion (only one process in the critical section at a time), Progress (a waiting process shouldn't wait forever if the section is free), Bounded Waiting (a limit on how many times others can enter before a waiting process gets its turn).
3.2 Semaphores
IdeaA semaphore is an integer variable accessed only via two atomic operations: wait()/P() decrements it (blocks if it goes negative); signal()/V() increments it (may wake a waiting process).
| Type | Idea |
|---|---|
| Binary semaphore (mutex) | Value only 0 or 1 — used for mutual exclusion (lock/unlock) |
| Counting semaphore | Value can be any integer — used to manage a limited pool of resources (e.g., N available buffers) |
JRF trap — mutex vs binary semaphoreA binary semaphore and a mutex look similar but differ subtly: a mutex is typically OWNED by the process that locks it (only that process can unlock it); a binary semaphore has NO ownership concept — any process/thread can signal() it, even one that didn't call wait(). This distinction is a favourite JRF conceptual trap.
3.3 Producer-Consumer Problem (Classic Example)
IdeaProducers add items to a shared bounded buffer; consumers remove items. Needs THREE semaphores:
mutex (binary, for exclusive buffer access), empty (counting, tracks empty slots, initialized to buffer size N), full (counting, tracks filled slots, initialized to 0).JRF insightThe producer does wait(empty) then wait(mutex) — in THIS order. Doing it in the reverse order (mutex first, then empty) can cause DEADLOCK: if the producer holds mutex and then blocks on a full buffer (waiting for empty), a consumer can never acquire mutex to free a slot. Getting the semaphore ORDER right is exactly what JRF tests here.
3.4 Deadlock — Necessary Conditions
The 4 Coffman Conditions (ALL must hold simultaneously for deadlock)
1. Mutual Exclusion — resource held exclusively by one process.
2. Hold and Wait — a process holds a resource while waiting for another.
3. No Preemption — a resource can't be forcibly taken away.
4. Circular Wait — a closed chain of processes, each waiting for a resource held by the next.
JRF trapTo PREVENT deadlock, you only need to break ONE of the four conditions — you don't need to break all of them. E.g., "resource ordering" (impose a strict order in which resources must be requested) breaks Circular Wait alone, which is sufficient to prevent deadlock.
3.5 Deadlock Handling Strategies
| Strategy | Idea |
|---|---|
| Prevention | Design the system so at least one Coffman condition can never hold |
| Avoidance | Allow requests but only grant them if the resulting state is still "safe" (e.g., Banker's Algorithm) |
| Detection & Recovery | Allow deadlock to happen, detect it (e.g., via resource-allocation graph cycles), then recover (kill/preempt a process) |
| Ignorance (Ostrich algorithm) | Assume deadlock is rare enough to ignore — used by many general-purpose OS (e.g., early UNIX) |
3.6 Banker's Algorithm (Deadlock Avoidance)
JRF-level numerical3 processes, 1 resource type with 10 total instances. Allocation: P1=3, P2=2, P3=2 (total allocated=7, so Available=10−7=3). Max need: P1=9, P2=4, P3=7 → Need = Max−Allocation: P1 needs 6, P2 needs 2, P3 needs 5.
Check safe sequence: Available=3. Can P2 finish? Need(P2)=2≤3 ✓ → run P2, release 2, Available=3+2=5. Can P1 finish? Need(P1)=6>5 ✗. Can P3 finish? Need(P3)=5≤5 ✓ → run P3, release 2, Available=5+2=7. Can P1 finish now? Need(P1)=6≤7 ✓ → run P1.
Safe sequence found: P2, P3, P1 — so the system IS in a safe state. This exact "find a safe sequence" trace is the classic Banker's Algorithm JRF numerical.
MUST REMEMBER — Chapter 3
- Critical section solution needs: Mutual Exclusion + Progress + Bounded Waiting.
- Binary semaphore = mutex-like (0/1); Counting semaphore = manages N resources.
- Mutex has ownership (only locker can unlock); binary semaphore has no ownership concept.
- Producer-Consumer needs mutex + empty + full semaphores; wrong wait() order can deadlock.
- 4 Coffman conditions (all needed for deadlock): Mutual Exclusion, Hold-and-Wait, No Preemption, Circular Wait.
- Breaking just ONE Coffman condition is enough to prevent deadlock.
- Banker's Algorithm: find a safe sequence by checking if Need ≤ Available at each step.
DON'T CONFUSE
- Mutex (has ownership) vs Binary semaphore (no ownership) — subtle but frequently tested.
- Deadlock Prevention (design-time, break a condition) vs Avoidance (runtime, check safety before granting) vs Detection (let it happen, find it, recover).
JRF CHALLENGE ZONE — Chapter 3
1. Which of the four Coffman conditions is broken by imposing a strict global order on resource requests? (a) Mutual Exclusion (b) Hold and Wait (c) No Preemption (d) Circular Wait
Answer: (d)
Answer: (d)
2. To prevent deadlock, how many of the four Coffman conditions must be broken? (a) All four (b) At least three (c) At least one (d) None, deadlock is unavoidable
Answer: (c)
Answer: (c)
3. In the producer-consumer solution, wait(empty) is called BEFORE wait(mutex) by the producer. What happens if this order is reversed? (a) No difference (b) Possible deadlock (c) Faster execution (d) Guaranteed starvation of consumer only
Answer: (b)
Answer: (b)
Practice Questions — Chapter 3 (8)
- What three requirements must a critical-section solution satisfy?
Ans: Mutual Exclusion, Progress, and Bounded Waiting - Differentiate a binary semaphore and a counting semaphore.
Ans: Binary semaphore takes only 0/1 (mutual exclusion); counting semaphore can take any integer (manages a pool of resources) - Does a binary semaphore have an ownership concept like a mutex?
Ans: No — any process/thread can signal a binary semaphore, unlike a mutex which only its locker can unlock - Name the three semaphores used in the classic Producer-Consumer solution.
Ans: mutex, empty, and full - List the four Coffman conditions necessary for deadlock.
Ans: Mutual Exclusion, Hold and Wait, No Preemption, Circular Wait - How many Coffman conditions must be broken to prevent deadlock?
Ans: Just one - What does the Banker's Algorithm check before granting a resource request?
Ans: Whether granting the request still leaves the system in a "safe" state (a safe sequence exists) - Differentiate deadlock prevention and deadlock avoidance.
Ans: Prevention designs the system so a Coffman condition can never occur; avoidance allows requests but only grants them if the resulting state stays safe
Chapter 4 — Memory Management
4.1 Contiguous Allocation & Fragmentation
| Type | Meaning |
|---|---|
| External fragmentation | Enough TOTAL free memory exists, but scattered in small non-contiguous chunks, no single chunk big enough |
| Internal fragmentation | Allocated block is LARGER than needed, wasting space WITHIN the allocated block itself |
JRF trapPaging eliminates EXTERNAL fragmentation (fixed-size frames fit any free frame) but can still cause INTERNAL fragmentation (last page of a process may not fully use its frame). Segmentation eliminates internal fragmentation (variable-sized segments fit exactly) but can suffer from external fragmentation. Mixing up which technique solves which type is very common.
4.2 Paging
IdeaPhysical memory divided into fixed-size FRAMES; logical memory divided into same-size PAGES. A page table maps each page to a frame.
Logical Address = (Page Number, Offset)
Physical Address = (Frame Number, Offset) [offset stays the same]
Number of bits for offset = log2(page size)
Number of pages = Logical Address Space / Page Size
Worked examplePage size = 1KB (2^10), logical address space = 16 bits. Offset needs 10 bits (log2 1024=10); remaining 16−10=6 bits for page number → number of pages = 2^6 = 64.
4.3 Page Replacement Algorithms
JRF-level numerical — FIFOReference string: 1,2,3,4,1,2,5,1,2,3,4,5 with 3 frames, using FIFO:
1,2,3 → fault,fault,fault (frames:1,2,3). 4 → fault, evict 1 (oldest) → frames:2,3,4. 1 → fault, evict 2 → frames:3,4,1. 2 → fault, evict 3 → frames:4,1,2. 5 → fault, evict 4 → frames:1,2,5. 1 → hit. 2 → hit. 3 → fault, evict 1 → frames:2,5,3. 4 → fault, evict 2 → frames:5,3,4. 5 → hit.
Total page faults = 9 (out of 12 references) — this exact reference-string trace format is THE most common page-replacement numerical.
JRF-level numerical — LRU (same string)Using LRU instead (evict the Least Recently Used): 1,2,3 → fault×3. 4 → fault, evict 1(LRU) → 2,3,4. 1 → fault, evict 2(LRU) → 3,4,1. 2 → fault, evict 3(LRU) → 4,1,2. 5 → fault, evict 4(LRU) → 1,2,5. 1→hit(now MRU). 2→hit. 3 → fault, evict 5(LRU, since 1,2 used more recently) → 1,2,3. 4 → fault, evict 1(LRU) → 2,3,4. 5 → fault, evict 2(LRU) → 3,4,5.
Total page faults = 10. Comparing FIFO vs LRU vs Optimal fault counts on the SAME reference string is a classic JRF comparison question.
Trap — Belady's AnomalyFor FIFO specifically, INCREASING the number of frames can sometimes INCREASE the number of page faults (counter-intuitive!) — this is called Belady's Anomaly. LRU and Optimal do NOT suffer from this anomaly.
NET pointThe Optimal (OPT/MIN) algorithm evicts the page that will NOT be used for the LONGEST time in the future — it gives the theoretical minimum number of page faults, but requires future knowledge, so it's used only as a benchmark, not implementable in practice.
4.4 Virtual Memory & Thrashing
IdeaVirtual memory lets a process execute even if it isn't entirely in physical memory — pages are brought in on demand ("demand paging"). Thrashing occurs when the CPU spends MORE time swapping pages in/out than doing actual useful work — usually caused by too many processes / too little memory (degree of multiprogramming too high).
JRF insightThrashing is detected/fixed using the "working set" model — keep enough frames in memory to hold each process's actively-used page set (its "working set"); if total memory demand exceeds available frames, REDUCE the degree of multiprogramming (suspend some processes) rather than adding more processes.
4.5 Segmentation
IdeaMemory divided into variable-sized SEGMENTS based on logical program units (code segment, data segment, stack segment) — matches how programmers actually think about a program, unlike paging's arbitrary fixed-size division.
MUST REMEMBER — Chapter 4
- External fragmentation = scattered free space; Internal fragmentation = wasted space within an allocated block.
- Paging avoids external fragmentation (but may have internal); Segmentation avoids internal (but may have external).
- FIFO evicts oldest-loaded page; LRU evicts least-recently-used; Optimal evicts the page needed furthest in the future (benchmark only).
- Belady's Anomaly: for FIFO, more frames can mean MORE faults (LRU/Optimal don't have this issue).
- Thrashing = more time swapping than computing; fixed by reducing degree of multiprogramming (working-set model).
DON'T CONFUSE
- Paging (fixed-size, avoids external fragmentation) vs Segmentation (variable-size, avoids internal fragmentation).
- FIFO (oldest loaded) vs LRU (least recently USED) — different criteria entirely.
JRF CHALLENGE ZONE — Chapter 4
1. Reference string 7,0,1,2,0,3,0,4 with 3 frames, FIFO. Find total page faults.
Answer: 7,0,1→fault×3(7,0,1). 2→fault,evict7(0,1,2). 0→hit. 3→fault,evict0(1,2,3). 0→fault,evict1(2,3,0). 4→fault,evict2(3,0,4). Total faults=6.
Answer: 7,0,1→fault×3(7,0,1). 2→fault,evict7(0,1,2). 0→hit. 3→fault,evict0(1,2,3). 0→fault,evict1(2,3,0). 4→fault,evict2(3,0,4). Total faults=6.
2. Belady's Anomaly (faults increasing with more frames) is specifically associated with: (a) LRU (b) Optimal (c) FIFO (d) All algorithms equally
Answer: (c)
Answer: (c)
3. Thrashing is best resolved by: (a) Increasing degree of multiprogramming (b) Decreasing degree of multiprogramming (c) Using a faster CPU only (d) Disabling virtual memory
Answer: (b)
Answer: (b)
Practice Questions — Chapter 4 (8)
- Differentiate internal and external fragmentation.
Ans: Internal = wasted space within an allocated block; External = scattered free space too fragmented to satisfy a request - Which fragmentation type does paging avoid, and which can it still have?
Ans: Avoids external fragmentation; can still have internal fragmentation (last page not fully used) - Page size = 2KB, logical address space = 20 bits. How many bits for the offset, and how many pages exist?
Ans: Offset = log2(2048) = 11 bits; pages = 2^(20−11) = 2^9 = 512 - What does the FIFO page replacement algorithm evict?
Ans: The page that has been in memory the longest (oldest loaded) - What does the LRU page replacement algorithm evict?
Ans: The page that was least recently used (accessed furthest in the past) - What is Belady's Anomaly, and which algorithm shows it?
Ans: More frames sometimes causing MORE page faults; shown by FIFO - What is thrashing, and what usually causes it?
Ans: The CPU spends more time swapping pages than doing useful work; usually caused by too high a degree of multiprogramming for available memory - Why does segmentation match a programmer's view of a program better than paging?
Ans: Segments correspond to logical program units (code, data, stack) rather than arbitrary fixed-size blocks
Chapter 5 — Storage Management
5.1 Disk Scheduling — Why It's Needed
SimpleA disk's read/write head must physically move across tracks — disk scheduling decides the ORDER of pending I/O requests to minimize total head movement (seek time), improving throughput.
5.2 FCFS & SSTF Disk Scheduling
Worked example — FCFSHead starts at track 50. Requests (in arrival order): 82, 170, 43, 140, 24, 16, 190.
FCFS total head movement = |50−82|+|82−170|+|170−43|+|43−140|+|140−24|+|24−16|+|16−190| = 32+88+127+97+116+8+174 = 642 tracks.
Worked example — SSTF (Shortest Seek Time First)Same requests, head starts at 50 — always pick the CLOSEST pending request next: 50→43(7)→24(19)→16(8)→82(66)→140(58)→170(30)→190(20).
Total = 7+19+8+66+58+30+20 = 208 tracks — much better than FCFS, but SSTF can cause STARVATION of far-away requests if closer ones keep arriving.
5.3 SCAN, C-SCAN, LOOK, C-LOOK
| Algorithm | Idea |
|---|---|
| SCAN ("elevator") | Head moves in one direction servicing requests until it hits the disk END, then reverses |
| C-SCAN | Like SCAN, but after reaching one end, JUMPS back to the other end (no servicing on the return) — gives more UNIFORM wait times |
| LOOK | Like SCAN, but reverses as soon as there are NO MORE requests in the current direction (doesn't go all the way to the disk end) |
| C-LOOK | Like C-SCAN, but only goes as far as the last request in each direction (not the disk end) |
JRF-level numerical — SCANHead at 50, moving TOWARD LARGER track numbers, disk range 0-199, requests: 82,170,43,140,24,16,190.
Moving up: 50→82(32)→140(58)→170(30)→190(20)→199(9, disk end). Then reverse: 199→43(156)→24(19)→16(8).
Total = 32+58+30+20+9+156+19+8 = 332 tracks. Note SCAN goes all the way to 199 (disk end) even though no request is exactly there — that's the key SCAN-vs-LOOK distinction tested numerically.
Trap — SCAN vs LOOKSCAN travels all the way to the physical disk boundary (0 or max track) before reversing, even with no pending requests there. LOOK only travels as far as the LAST REQUEST in that direction, then immediately reverses — saving unnecessary movement. This exact distinction is the #1 disk-scheduling JRF trap.
5.4 RAID Levels
| RAID Level | Idea |
|---|---|
| RAID 0 | Striping only — data split across disks for SPEED, but NO redundancy (one disk failure = data loss) |
| RAID 1 | Mirroring — full duplicate copy on a second disk; high reliability, but 50% storage efficiency |
| RAID 5 | Block-level striping WITH distributed parity — tolerates ONE disk failure, good balance of speed/reliability/cost |
| RAID 6 | Like RAID 5 but with DOUBLE distributed parity — tolerates TWO disk failures |
NET pointRAID 0 improves PERFORMANCE only (no fault tolerance — it actually INCREASES failure risk since ANY one disk failing loses all data). RAID 1 improves RELIABILITY at the cost of storage efficiency. This "RAID 0 has worse reliability than a single disk" fact is a common surprising-but-testable point.
MUST REMEMBER — Chapter 5
- SSTF minimizes seek time greedily but can starve far-away requests.
- SCAN goes all the way to the disk boundary before reversing; LOOK stops at the last actual request.
- C-SCAN/C-LOOK give more uniform wait times by only servicing in one direction (jump back without servicing).
- RAID 0 = striping, speed only, NO redundancy (higher failure risk than a single disk).
- RAID 1 = mirroring, high reliability, 50% storage efficiency.
- RAID 5 = distributed parity, survives 1 disk failure; RAID 6 = double parity, survives 2 disk failures.
DON'T CONFUSE
- SCAN (goes to disk end) vs LOOK (stops at last request) — the most tested disk-scheduling distinction.
- RAID 0 (speed, no redundancy) vs RAID 1 (redundancy via mirroring).
JRF CHALLENGE ZONE — Chapter 5
1. Head at 53, requests: 98,183,37,122,14,124,65,67, disk range 0-199, using SSTF. Which request is serviced FIRST? (a) 98 (b) 65 (c) 37 (d) 14
Answer: (b) — 65 is closest to 53 (distance 12).
Answer: (b) — 65 is closest to 53 (distance 12).
2. Which disk-scheduling algorithm can cause starvation of far-away requests? (a) FCFS (b) SSTF (c) SCAN (d) C-SCAN
Answer: (b)
Answer: (b)
3. Which RAID level provides NO fault tolerance? (a) RAID 0 (b) RAID 1 (c) RAID 5 (d) RAID 6
Answer: (a)
Answer: (a)
Practice Questions — Chapter 5 (7)
- Why is disk scheduling needed?
Ans: To minimize total head movement (seek time) and improve throughput when servicing multiple I/O requests - What is the main weakness of SSTF?
Ans: It can cause starvation of requests far from the current head position - Differentiate SCAN and LOOK.
Ans: SCAN travels to the disk's physical end before reversing; LOOK reverses as soon as there are no more requests in the current direction - Why does C-SCAN give more uniform wait times than SCAN?
Ans: It only services requests in one direction and jumps back without servicing, avoiding the uneven wait caused by reversing direction - What does RAID 0 provide, and what does it NOT provide?
Ans: Provides speed via striping; provides no redundancy/fault tolerance - How many disk failures can RAID 5 tolerate? RAID 6?
Ans: RAID 5: one failure; RAID 6: two failures - What is the storage efficiency tradeoff of RAID 1 (mirroring)?
Ans: Only 50% of total disk capacity is usable, since every block is duplicated
Chapter 6 — File Management
6.1 File Allocation Methods
| Method | Idea |
|---|---|
| Contiguous allocation | File occupies a single continuous block of disk space — fast sequential AND random access, but suffers external fragmentation, hard to grow file size |
| Linked allocation | File is a chain of blocks, each pointing to the next — no external fragmentation, easy to grow, but SLOW random access (must follow the chain) and pointer overhead |
| Indexed allocation | A separate INDEX BLOCK stores pointers to all the file's data blocks — supports fast direct/random access without contiguous storage |
JRF trapLinked allocation's biggest weakness is RANDOM ACCESS — to reach block 50 of a file, you must traverse all 49 previous blocks' pointers sequentially, unlike indexed allocation where the index block gives direct access to any block. This performance gap is a very common JRF distinguishing question.
6.2 Directory Structures
| Structure | Idea |
|---|---|
| Single-level | One directory for all files — simple but no organization, name conflicts |
| Two-level | Separate directory per user — avoids conflicts between users, but no further sub-organization |
| Tree-structured | Hierarchical directories/subdirectories (standard in modern OS) — flexible organization |
| Acyclic graph | Allows shared files/directories (via links) between different directories — but must be careful to avoid cycles |
6.3 File Access Methods
IdeaSequential access: read bytes/records in order from the beginning (like tape). Direct (random) access: jump straight to any block/record by its number, without reading everything before it.
MUST REMEMBER — Chapter 6
- Contiguous: fast access, external fragmentation, hard to grow.
- Linked: no external fragmentation, easy to grow, but SLOW random access (must traverse the chain).
- Indexed: fast direct access via a separate index block, avoids linked-list traversal.
- Directory structures: Single-level → Two-level → Tree-structured (hierarchical) → Acyclic graph (allows sharing).
DON'T CONFUSE
- Linked allocation (slow random access, must traverse) vs Indexed allocation (fast direct access via index block).
- Tree-structured directory (no sharing/cycles) vs Acyclic graph directory (allows shared files).
JRF CHALLENGE ZONE — Chapter 6
1. Which file allocation method has the WORST random-access performance? (a) Contiguous (b) Linked (c) Indexed (d) All equal
Answer: (b)
Answer: (b)
2. Which directory structure allows the SAME file to be shared/linked between two different directories? (a) Single-level (b) Two-level (c) Tree-structured (strictly) (d) Acyclic graph
Answer: (d)
Answer: (d)
Practice Questions — Chapter 6 (5)
- Which file allocation method suffers from external fragmentation?
Ans: Contiguous allocation - Why is random access slow in linked allocation?
Ans: Reaching a block requires following pointers sequentially from the start of the chain - How does indexed allocation solve the random-access problem of linked allocation?
Ans: A separate index block stores pointers to all data blocks, allowing direct access to any block - What is the key limitation of a single-level directory structure?
Ans: No organization — all files share one namespace, causing naming conflicts between users - What additional capability does an acyclic-graph directory structure provide over a strict tree?
Ans: It allows a file/directory to be shared (linked) from multiple parent directories
Chapter 7 — Threads and System Calls
7.1 Thread vs Process
| Process | Thread | |
|---|---|---|
| Memory | Own separate address space | Shares address space with other threads of the same process |
| Creation cost | Expensive (heavy) | Cheap (lightweight) |
| Communication | Needs IPC (inter-process communication) | Direct (shared memory) — much faster |
| Crash impact | Isolated — one process crashing doesn't directly crash another | One thread crashing can bring down the whole process (shared memory) |
JRF trapThreads of the SAME process share the code, data, and heap segments — but each thread has its OWN stack and own set of registers/program counter. Forgetting that each thread needs its own stack (for independent function calls/local variables) is a common gap in understanding.
7.2 Multithreading Models
| Model | Idea |
|---|---|
| Many-to-One | Many user threads mapped to ONE kernel thread — fast thread management, but ONE blocking call blocks ALL threads |
| One-to-One | Each user thread maps to its own kernel thread — true parallelism, but thread creation is more expensive (each needs a kernel thread) |
| Many-to-Many | Many user threads multiplexed onto a smaller/equal number of kernel threads — flexible, gets benefits of both |
7.3 System Calls — Types (Recap & Depth)
IdeaSystem calls are typically invoked via a library wrapper function; the actual transition to kernel mode happens via a software interrupt/trap instruction (e.g., historically
int 0x80 on x86 Linux, now often a faster dedicated instruction like syscall).NET pointfork() creates a new (child) process as a near-copy of the parent — it returns 0 in the child process and the child's PID in the parent process. This "different return value in parent vs child" behaviour is a classic fork() trace question.
MUST REMEMBER — Chapter 7
- Threads share code/data/heap with their process, but each has its own stack and registers.
- Many-to-One: fast but one block stops all; One-to-One: true parallelism but expensive; Many-to-Many: balanced.
- fork() returns 0 in the child, child's PID in the parent.
- Thread creation is much cheaper than process creation.
DON'T CONFUSE
- Many-to-One (all threads blocked by one blocking call) vs One-to-One (true kernel-level parallelism).
- What threads SHARE (code/data/heap) vs what's PRIVATE to each thread (stack, registers, PC).
JRF CHALLENGE ZONE — Chapter 7
1. In which multithreading model does a single blocking system call block ALL threads of the process? (a) One-to-One (b) Many-to-One (c) Many-to-Many (d) None
Answer: (b)
Answer: (b)
2. After fork(), the return value in the CHILD process is: (a) The parent's PID (b) 0 (c) The child's own PID (d) −1 always
Answer: (b)
Answer: (b)
Practice Questions — Chapter 7 (5)
- What do threads of the same process share, and what is private to each?
Ans: Share code, data, and heap; each thread has its own private stack and registers/program counter - Why is thread creation cheaper than process creation?
Ans: Threads share the process's existing address space rather than needing a completely separate one - What is the weakness of the Many-to-One multithreading model?
Ans: A single blocking system call blocks all threads of the process, since they map to only one kernel thread - What does fork() return in the parent process, and in the child process?
Ans: Parent gets the child's PID; child gets 0 - What mechanism does a system call use to switch from user mode to kernel mode?
Ans: A software interrupt/trap instruction
Chapter 8 — System Software
8.1 Assemblers, Compilers, Interpreters
| Tool | Idea |
|---|---|
| Assembler | Translates assembly language (mnemonics) into machine code |
| Compiler | Translates an ENTIRE high-level source program into machine/object code BEFORE execution |
| Interpreter | Translates and EXECUTES source code line-by-line, without producing a full separate machine-code file |
JRF trap — compiler vs interpreter tradeoffsCompiled programs generally run FASTER (translation done once, upfront) but errors are only reported after full compilation, and debugging line-by-line is harder. Interpreted programs run SLOWER (translation happens every execution) but allow immediate error detection at the exact failing line and easier interactive debugging. A "compile once, run many times" vs "translate every single run" tradeoff is the key JRF concept.
8.2 Linkers & Loaders
IdeaA Linker combines multiple object files (and needed libraries) into a single executable, resolving references between them (e.g., a function call in one file to a function defined in another). A Loader then loads that executable into memory and prepares it for execution (allocating memory, setting up the initial program counter).
NET pointStatic linking embeds all needed library code directly INTO the executable at link time (larger file, no external dependency at runtime). Dynamic linking links to shared libraries only at LOAD/RUN time (smaller executable, but the shared library (.dll/.so) must be present on the system).
8.3 Compiler Phases (Overview)
Source Code
→ Lexical Analysis (tokens)
→ Syntax Analysis (parse tree)
→ Semantic Analysis (type checking)
→ Intermediate Code Generation
→ Code Optimization
→ Code Generation
→ Target Machine Code
JRF trapLexical analysis catches errors like invalid characters/malformed tokens. Syntax analysis catches grammar structure errors (e.g., mismatched parentheses). Semantic analysis catches MEANING errors that are still grammatically valid (e.g., adding an int to a string, using an undeclared variable) — identifying WHICH phase catches a given error type is a common JRF question.
MUST REMEMBER — Chapter 8
- Compiler translates the whole program upfront (fast execution, delayed error reporting); Interpreter translates+executes line-by-line (slower, immediate error feedback).
- Linker combines object files + resolves references; Loader loads the executable into memory for execution.
- Static linking = embedded at link time (larger file, no runtime dependency); Dynamic linking = linked at load/run time (smaller file, needs the shared library present).
- Compiler phases order: Lexical → Syntax → Semantic → Intermediate Code → Optimization → Code Generation.
- Lexical=token errors; Syntax=grammar/structure errors; Semantic=meaning errors (type mismatches, undeclared variables).
DON'T CONFUSE
- Compiler (translate all, then run) vs Interpreter (translate+run line-by-line).
- Linker (combines/resolves object files) vs Loader (loads executable into memory).
- Syntax errors (structure) vs Semantic errors (meaning) — easy to conflate.
JRF CHALLENGE ZONE — Chapter 8
1. Using an undeclared variable in an otherwise grammatically correct statement is caught at which phase? (a) Lexical analysis (b) Syntax analysis (c) Semantic analysis (d) Code generation
Answer: (c)
Answer: (c)
2. Which linking approach results in a SMALLER executable file but requires the library to be present at runtime? (a) Static linking (b) Dynamic linking (c) Both are identical in size (d) Neither uses linking
Answer: (b)
Answer: (b)
Practice Questions — Chapter 8 (6)
- Differentiate a compiler and an interpreter.
Ans: A compiler translates the whole program before execution; an interpreter translates and executes line-by-line each run - What does a linker do?
Ans: Combines multiple object files/libraries into a single executable, resolving references between them - What does a loader do?
Ans: Loads the executable into memory and prepares it for execution - Differentiate static and dynamic linking.
Ans: Static linking embeds library code into the executable at link time; dynamic linking links to shared libraries at load/run time - List the phases of a compiler in order.
Ans: Lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation - Which compiler phase would catch "using a variable of type int as if it were a string"?
Ans: Semantic analysis
Chapter 9 — LINUX Operating System
9.1 LINUX Architecture
Hardware
→ Kernel (process/memory/file/device management)
→ Shell (command interpreter)
→ Applications / User
IdeaLinux is a monolithic-kernel-based, multiuser, multitasking OS. The Shell is the command-line interface between the user and the kernel — it interprets typed commands and requests kernel services accordingly.
9.2 File System Structure
SimpleLinux uses a single unified hierarchical directory tree starting from root "/" — even separate physical disks/partitions are "mounted" into this one tree, unlike Windows' separate drive letters (C:, D:).
| Directory | Purpose |
|---|---|
| /bin | Essential user command binaries |
| /etc | System configuration files |
| /home | User home directories |
| /var | Variable data — logs, spool files |
| /proc | Virtual filesystem exposing kernel/process info (not real files on disk) |
9.3 Basic Commands & Permissions
File permissionsLinux file permissions: Read(r), Write(w), Execute(x), separately for Owner, Group, and Others — often shown as a 9-character string (e.g., rwxr-xr--) or a 3-digit octal number (e.g., 754).
Worked example — permission decodingrwxr-xr-- : Owner=rwx(7: 4+2+1), Group=r-x(5: 4+0+1), Others=r--(4: 4+0+0) → octal = 754.
JRF trapchmod 644 file.txt gives Owner=rw-(6), Group=r--(4), Others=r--(4) — Owner CANNOT execute it, only read/write. Students often assume the owner automatically has full permissions; permissions are purely what's explicitly set in each digit.
9.4 Process Management in Linux
ps— lists running processes.kill -9 PID— forcibly terminates a process (SIGKILL).&at the end of a command — runs it in the BACKGROUND.nice— sets/adjusts a process's scheduling priority.
MUST REMEMBER — Chapter 9
- Linux uses ONE unified directory tree from root "/" — disks are mounted INTO it, not given separate drive letters.
- Permissions: r=4, w=2, x=1, summed per Owner/Group/Others (e.g., rwxr-xr-- = 754).
- chmod digit values are exactly what's set — owner does NOT automatically get execute permission.
- /etc = config files; /home = user directories; /proc = virtual filesystem for kernel/process info.
- kill -9 sends SIGKILL (forceful termination).
DON'T CONFUSE
- /bin (essential binaries) vs /var (variable/log data) vs /proc (virtual, not real disk files).
- Octal permission digits — don't assume owner automatically has all permissions.
JRF CHALLENGE ZONE — Chapter 9
1. chmod 640 file.txt sets which permissions for "Others"? (a) rwx (b) r-- (c) --- (d) rw-
Answer: (c) — 0 = no permissions at all.
Answer: (c) — 0 = no permissions at all.
2. Which directory holds a virtual filesystem exposing kernel/process information, not real disk files? (a) /etc (b) /bin (c) /proc (d) /var
Answer: (c)
Answer: (c)
Practice Questions — Chapter 9 (6)
- What is the Shell's role in Linux?
Ans: It's the command interpreter between the user and the kernel, translating typed commands into kernel requests - How does Linux's file system structure differ from Windows' drive-letter approach?
Ans: Linux uses one unified tree from root "/", mounting all disks/partitions into it, rather than separate drive letters - Decode the permission string rw-r--r-- into its octal form.
Ans: Owner=rw-(6), Group=r--(4), Others=r--(4) → 644 - What does chmod 700 mean for a file?
Ans: Owner has full rwx permissions; Group and Others have no permissions at all - What does /etc typically contain?
Ans: System configuration files - What signal does "kill -9" send to a process?
Ans: SIGKILL, forcibly terminating it
One-Shot Revision — Unit 4
Key facts across all chapters
- Multiprogramming = max CPU utilization; Time-sharing/Multitasking = fast interactive response. Hard real-time = missed deadline is failure; Soft = quality loss only.
- Monolithic = fast, hard to maintain; Microkernel = reliable/modular, slower. System call = user→kernel mode via trap.
- Turnaround=Completion−Arrival; Waiting=Turnaround−Burst. FCFS→convoy effect. SJF/SRTF→min avg wait but starvation risk. RR→fairness, quantum tradeoff. Priority→Aging prevents starvation.
- Critical section needs: Mutual Exclusion+Progress+Bounded Waiting. Mutex has ownership; binary semaphore doesn't.
- 4 Coffman conditions (all needed for deadlock): Mutual Exclusion, Hold&Wait, No Preemption, Circular Wait — break just ONE to prevent.
- Banker's Algorithm: find a safe sequence by checking Need≤Available at each step.
- Paging avoids external fragmentation (may have internal); Segmentation avoids internal (may have external).
- FIFO=oldest evicted (Belady's Anomaly possible); LRU=least-recently-used evicted; Optimal=benchmark only (needs future knowledge).
- Thrashing = more swapping than computing; fix by REDUCING degree of multiprogramming.
- SCAN goes to disk end before reversing; LOOK stops at last request. SSTF can starve far requests.
- RAID 0=striping only (no redundancy, riskier than single disk); RAID 1=mirroring; RAID 5=1 parity (survives 1 failure); RAID 6=2 parity (survives 2).
- Linked allocation=slow random access (traverse chain); Indexed=fast direct access via index block.
- Threads share code/data/heap; each has own stack+registers. Many-to-One=one block stops all; One-to-One=true parallelism.
- fork(): returns 0 in child, child's PID in parent.
- Compiler=translate all upfront; Interpreter=translate+run line-by-line. Static linking=embedded at link time; Dynamic=linked at load/run time.
- Compiler phases: Lexical→Syntax→Semantic→Intermediate Code→Optimization→Code Generation.
- Linux: one unified directory tree from "/". Permissions: r=4,w=2,x=1 per Owner/Group/Others.
Potential future exam areasPotential high-value exam area based on syllabus importance and historical question patterns: combined CPU-scheduling numericals requiring a full Gantt-chart trace with average waiting/turnaround time; page-replacement reference-string comparisons across FIFO/LRU/Optimal on the same string; Banker's Algorithm safe-sequence numericals; disk-scheduling total-head-movement numericals (especially SCAN vs LOOK); and scenario-based deadlock-condition identification questions.
Unit 4 — UGC NET/JRF Mini Mock Test
50 questions across all 9 chapters. NTA/UGC NET-style question patterns — mixed NET/JRF difficulty, numerical, statement-based, matching and scenario-based. Answer key with brief explanations follows each question.
Q1. The primary goal of multiprogramming is: (a) Fast interactive response (b) Maximizing CPU utilization (c) Reducing memory (d) Guaranteeing deadlines
Ans: (b) [Ch1 | NET]
Ans: (b) [Ch1 | NET]
Q2. A microkernel design trades off: (a) Speed for modularity/reliability (b) Reliability for speed (c) Nothing (d) Memory for CPU only
Ans: (a) [Ch1 | NET]
Ans: (a) [Ch1 | NET]
Q3. P1(burst=6,arrival=0), P2(burst=4,arrival=0), P3(burst=2,arrival=0), FCFS order P1,P2,P3. Find average waiting time.
Ans: P1=0,P2=6,P3=10; avg=(0+6+10)/3=5.33 [Ch2 | NET numerical]
Ans: P1=0,P2=6,P3=10; avg=(0+6+10)/3=5.33 [Ch2 | NET numerical]
Q4. Which scheduling algorithm can cause the "convoy effect"? (a) SJF (b) FCFS (c) RR (d) Priority with aging
Ans: (b) [Ch2 | NET]
Ans: (b) [Ch2 | NET]
Q5. What technique prevents starvation in priority scheduling?
Ans: Aging [Ch2 | NET]
Ans: Aging [Ch2 | NET]
Q6. In Round Robin, a very small time quantum causes: (a) Better response, more overhead (b) Worse response, less overhead (c) No change (d) FCFS-like behaviour
Ans: (a) [Ch2 | NET]
Ans: (a) [Ch2 | NET]
Q7. Which requirement is NOT one of the three critical-section requirements? (a) Mutual Exclusion (b) Progress (c) Bounded Waiting (d) Starvation
Ans: (d) [Ch3 | NET]
Ans: (d) [Ch3 | NET]
Q8. A mutex differs from a binary semaphore mainly in: (a) Value range (b) Ownership (only the locker can unlock) (c) Speed (d) They are identical, no difference
Ans: (b) [Ch3 | JRF]
Ans: (b) [Ch3 | JRF]
Q9. How many Coffman conditions must be broken to prevent deadlock?
Ans: Just one (of the four) [Ch3 | NET]
Ans: Just one (of the four) [Ch3 | NET]
Q10. In the producer-consumer problem, which semaphore tracks EMPTY buffer slots?
Ans: The "empty" counting semaphore [Ch3 | NET]
Ans: The "empty" counting semaphore [Ch3 | NET]
Q11. A system has 3 processes and 1 resource type with 9 total instances. Allocation: P1=2,P2=3,P3=2 (Available=9−7=2). Need: P1=3,P2=1,P3=2. Which process can run first in a safe sequence?
Ans: P2 — Need(P2)=1≤Available(2). [Ch3 | JRF numerical]
Ans: P2 — Need(P2)=1≤Available(2). [Ch3 | JRF numerical]
Q12. Paging primarily eliminates: (a) Internal fragmentation (b) External fragmentation (c) Both (d) Neither
Ans: (b) [Ch4 | NET]
Ans: (b) [Ch4 | NET]
Q13. Page size=4KB, logical address space=32 bits. How many bits for the page number?
Ans: Offset=log2(4096)=12 bits; page number bits=32−12=20 [Ch4 | NET numerical]
Ans: Offset=log2(4096)=12 bits; page number bits=32−12=20 [Ch4 | NET numerical]
Q14. Which page replacement algorithm can exhibit Belady's Anomaly? (a) LRU (b) Optimal (c) FIFO (d) None
Ans: (c) [Ch4 | JRF]
Ans: (c) [Ch4 | JRF]
Q15. Thrashing is best resolved by: (a) Increasing multiprogramming degree (b) Decreasing multiprogramming degree (c) Disabling paging (d) Increasing quantum
Ans: (b) [Ch4 | NET]
Ans: (b) [Ch4 | NET]
Q16. Reference string 1,2,3,1,2,4,1,2,5 with 3 frames, FIFO. Find total page faults.
Ans: 1,2,3→fault×3(1,2,3). 1→hit. 2→hit. 4→fault,evict1(2,3,4). 1→fault,evict2(3,4,1). 2→fault,evict3(4,1,2). 5→fault,evict4(1,2,5). Total=7 [Ch4 | JRF numerical]
Ans: 1,2,3→fault×3(1,2,3). 1→hit. 2→hit. 4→fault,evict1(2,3,4). 1→fault,evict2(3,4,1). 2→fault,evict3(4,1,2). 5→fault,evict4(1,2,5). Total=7 [Ch4 | JRF numerical]
Q17. Which disk-scheduling algorithm always travels to the physical disk boundary before reversing direction? (a) LOOK (b) SCAN (c) SSTF (d) C-LOOK
Ans: (b) [Ch5 | NET]
Ans: (b) [Ch5 | NET]
Q18. Head at 100, requests: 30,86,147,91,177,94, disk 0-199, FCFS. Find total head movement.
Ans: |100-30|+|30-86|+|86-147|+|147-91|+|91-177|+|177-94| = 70+56+61+56+86+83 = 412 [Ch5 | NET numerical]
Ans: |100-30|+|30-86|+|86-147|+|147-91|+|91-177|+|177-94| = 70+56+61+56+86+83 = 412 [Ch5 | NET numerical]
Q19. Which RAID level offers speed via striping but NO redundancy? (a) RAID 0 (b) RAID 1 (c) RAID 5 (d) RAID 6
Ans: (a) [Ch5 | NET]
Ans: (a) [Ch5 | NET]
Q20. How many disk failures can RAID 6 tolerate?
Ans: Two [Ch5 | NET]
Ans: Two [Ch5 | NET]
Q21. Which file allocation method suffers most from slow random access due to pointer-chain traversal? (a) Contiguous (b) Linked (c) Indexed (d) None
Ans: (b) [Ch6 | NET]
Ans: (b) [Ch6 | NET]
Q22. Which directory structure allows a file to be linked/shared from multiple parent directories? (a) Single-level (b) Two-level (c) Strict tree (d) Acyclic graph
Ans: (d) [Ch6 | JRF]
Ans: (d) [Ch6 | JRF]
Q23. Threads of the same process share: (a) Stack only (b) Code, data, and heap (c) Registers only (d) Nothing
Ans: (b) [Ch7 | NET]
Ans: (b) [Ch7 | NET]
Q24. After fork(), what value does the PARENT process receive?
Ans: The child process's PID [Ch7 | NET]
Ans: The child process's PID [Ch7 | NET]
Q25. Which multithreading model maps many user threads to a single kernel thread? (a) One-to-One (b) Many-to-One (c) Many-to-Many (d) None
Ans: (b) [Ch7 | NET]
Ans: (b) [Ch7 | NET]
Q26. Which is TRUE about compiled vs interpreted execution? (a) Compiled is always slower (b) Interpreted gives immediate line-by-line error feedback (c) Interpreters produce a separate executable file (d) Compilers execute code directly without translation
Ans: (b) [Ch8 | NET]
Ans: (b) [Ch8 | NET]
Q27. Using an undeclared variable in valid-looking code is caught at: (a) Lexical analysis (b) Syntax analysis (c) Semantic analysis (d) Code generation
Ans: (c) [Ch8 | JRF]
Ans: (c) [Ch8 | JRF]
Q28. Which linking type results in a smaller executable but needs the library present at runtime? (a) Static (b) Dynamic (c) Both same (d) Neither
Ans: (b) [Ch8 | NET]
Ans: (b) [Ch8 | NET]
Q29. What does a linker primarily do?
Ans: Combines object files/libraries into one executable, resolving references [Ch8 | NET]
Ans: Combines object files/libraries into one executable, resolving references [Ch8 | NET]
Q30. chmod 750 sets which permission for "Others"? (a) rwx (b) r-x (c) --- (d) rw-
Ans: (c) [Ch9 | NET numerical]
Ans: (c) [Ch9 | NET numerical]
Q31. Which Linux directory holds a virtual filesystem exposing kernel/process info?
Ans: /proc [Ch9 | NET]
Ans: /proc [Ch9 | NET]
Q32. What signal does "kill -9" send?
Ans: SIGKILL (forceful termination) [Ch9 | NET]
Ans: SIGKILL (forceful termination) [Ch9 | NET]
Q33. A process can move from Running directly to Ready: (a) On its own, anytime (b) Only via a scheduler/interrupt decision (c) Never (d) Only during I/O
Ans: (b) [Ch2 | JRF]
Ans: (b) [Ch2 | JRF]
Q34. In the LRU algorithm, which page is evicted?
Ans: The least recently used (accessed furthest in the past) page [Ch4 | NET]
Ans: The least recently used (accessed furthest in the past) page [Ch4 | NET]
Q35. Which of these is a HARD real-time system requirement violation example? (a) A dropped video frame (b) A missed airbag deployment deadline (c) A slow webpage load (d) A delayed email
Ans: (b) [Ch1 | NET]
Ans: (b) [Ch1 | NET]
Q36. Segmentation primarily eliminates: (a) External fragmentation (b) Internal fragmentation (c) Both (d) Neither
Ans: (b) [Ch4 | NET]
Ans: (b) [Ch4 | NET]
Q37. Which algorithm gives the theoretical minimum page faults but is not implementable in practice? (a) FIFO (b) LRU (c) Optimal (d) Clock
Ans: (c) [Ch4 | NET]
Ans: (c) [Ch4 | NET]
Q38. SSTF stands for: (a) Shortest Seek Time First (b) Sequential Scan Track First (c) Simple Sector Track Fetch (d) Static Storage Table Format
Ans: (a) [Ch5 | NET]
Ans: (a) [Ch5 | NET]
Q39. Which structure stores all info about a process (PID, state, registers, etc.)?
Ans: PCB (Process Control Block) [Ch2 | NET]
Ans: PCB (Process Control Block) [Ch2 | NET]
Q40. A binary semaphore used purely for mutual exclusion is also called a:
Ans: Mutex-like lock (though technically distinct from a true mutex in ownership) [Ch3 | NET]
Ans: Mutex-like lock (though technically distinct from a true mutex in ownership) [Ch3 | NET]
Q41. Which RAID level uses double distributed parity?
Ans: RAID 6 [Ch5 | NET]
Ans: RAID 6 [Ch5 | NET]
Q42. Indexed file allocation improves on linked allocation mainly by: (a) Using less disk space (b) Providing fast direct access via an index block (c) Removing the need for any pointers (d) Eliminating external fragmentation
Ans: (b) [Ch6 | JRF]
Ans: (b) [Ch6 | JRF]
Q43. Which of these is a process-control system call? (a) open() (b) fork() (c) read() (d) ioctl()
Ans: (b) [Ch1 | NET]
Ans: (b) [Ch1 | NET]
Q44. One-to-One threading model's main disadvantage is: (a) Blocking calls block all threads (b) Higher thread-creation overhead (needs a kernel thread each) (c) No parallelism (d) No disadvantage
Ans: (b) [Ch7 | JRF]
Ans: (b) [Ch7 | JRF]
Q45. Which compiler phase directly precedes Code Generation?
Ans: Code Optimization [Ch8 | NET]
Ans: Code Optimization [Ch8 | NET]
Q46. What is the octal permission value for rwxrwxrwx?
Ans: 777 [Ch9 | NET numerical]
Ans: 777 [Ch9 | NET numerical]
Q47. Which scheduling algorithm is provably optimal for minimizing AVERAGE waiting time (non-preemptive, given known burst times)?
Ans: SJF (Shortest Job First) [Ch2 | NET]
Ans: SJF (Shortest Job First) [Ch2 | NET]
Q48. Deadlock's "Hold and Wait" condition means: (a) A resource can't be preempted (b) A process holds a resource while waiting for another (c) Processes form a closed chain (d) Only one process can use a resource
Ans: (b) [Ch3 | NET]
Ans: (b) [Ch3 | NET]
Q49. Which memory-mapping approach divides memory into VARIABLE-sized logical units matching a programmer's view? (a) Paging (b) Segmentation (c) Both equally (d) Neither
Ans: (b) [Ch4 | NET]
Ans: (b) [Ch4 | NET]
Q50. Which of these is FALSE? (a) RAID 0 has no redundancy (b) RAID 1 halves usable storage capacity (c) RAID 0 improves fault tolerance over a single disk (d) RAID 5 uses distributed parity
Ans: (c) — RAID 0 actually has WORSE fault tolerance than a single disk. [Ch5 | JRF]
Ans: (c) — RAID 0 actually has WORSE fault tolerance than a single disk. [Ch5 | JRF]
— End of Mock Test — Cross-check your score, revisit the "Don't Confuse" and "JRF Challenge Zone" boxes for any topic you missed, then re-attempt after 48 hours. —
0 comments:
Post a Comment