📝 Operating Systems Concepts (30 MCQs)
Core Abstractions and Responsibilities of an Operating System
Operating system concepts describe the abstractions and control mechanisms through which a kernel coordinates processors, memory, storage, and devices. Processes represent executing programs; virtual address spaces isolate memory; files organise persistent data; and system calls expose controlled services. Together, these abstractions hide hardware details while preserving protection, concurrency, and resource sharing across applications without requiring individual programs to manage hardware directly.
Why Shared Hardware Requires Operating System Control
These concepts developed because applications compete for finite resources and must not interfere with one another. Direct hardware access makes resource sharing unsafe and device-specific programming difficult. An operating system therefore requires privileged control, common interfaces, scheduling policies, and isolation boundaries. No single policy suits every workload, so mechanisms remain distinguishable from policies that can change according to system requirements.
System Calls, Kernel Execution, and Resource Coordination
An application requests a service through a system call, causing a controlled transition from user mode to kernel mode. The kernel validates arguments and permissions, invokes the appropriate subsystem, and updates process or resource state. Interrupts and exceptions report external events or faults; the scheduler selects runnable processes, while memory and I/O managers enforce their respective controls.
Tracing a File Read Through Kernel Subsystems
A process issuing read() for 4 KiB from a file enters the kernel through a system call. When the requested data is cached, the kernel can satisfy the request and return it to the process. On a cache miss, the process may block for device I/O; the scheduler runs another ready process until completion makes the waiting reader runnable again.
Resource Utilisation, Protection, and System Performance
These abstractions improve utilisation by allowing CPU execution to overlap I/O, while scheduling supports responsiveness and address-space isolation protects processes. They underpin desktops, servers, embedded systems, and mobile devices. Their costs include context switches, memory overhead, system-call transitions, and policy trade-offs. Excessive resource contention or inefficient management can reduce throughput and increase application response times.
Misunderstandings About Kernel Services and Execution
'A system call is an ordinary function call' is incorrect because it crosses a controlled privilege boundary. 'The kernel runs every program' is incorrect because applications normally execute in user mode. 'Multiprogramming means parallel execution' is incorrect because one CPU interleaves tasks, whereas simultaneous execution requires multiple processing cores.
Exam Focus: Kernel Boundaries and Operating System Mechanisms
Be prepared to trace a system call from user mode into the kernel, identify the subsystem handling it, and explain the return path. Compare process, memory, file, and I/O abstractions; distinguish interrupts from system calls, mechanisms from policies, and concurrency from parallelism. Examination questions commonly assess privilege transitions, resource allocation, isolation, and performance trade-offs.
Core Terms in Operating System Design
- Process - Program currently executing.
- Kernel - Privileged core of the operating system.
- System call - Controlled request for kernel service.
- User mode - Restricted execution privilege.
- Interrupt - Signal requiring processor attention.
- Virtual address space - Process-specific logical memory range.
📝 All Operating Systems Concepts MCQs
Q1. A web-server process is waiting for a disk read. The disk controller signals that the requested data is available, but the CPU is executing another process. Which state transition should the operating system make for the waiting process?
📖 Explanation: Completion of the requested I/O removes the event that blocked the process, so it becomes ready and joins the scheduling queue. The tempting choice is Blocked to Running, but dispatching still requires CPU selection.
Q2. During a context switch, the kernel must preserve enough information to resume the displaced process correctly. Which item is normally stored in that process's process control block?
📖 Explanation: The program counter identifies the next instruction when execution resumes, so it belongs in the process control block with registers and state. Source code is not saved there; the executable remains elsewhere.
Q3. A server creates a worker with fork(), then the child calls exec() to run a request-handler program. Which description correctly distinguishes the two calls?
📖 Explanation: fork() creates a child with a distinct process identifier, while exec() loads a new program into the calling process. The tempting choice reverses their roles; exec() does not create another process.
Q4. A batch system uses preemptive shortest-remaining-time-first scheduling. Processes arrive as follows: A arrives at 0 with burst 7, B at 2 with burst 4, and C at 4 with burst 1. What is the average waiting time?
📖 Explanation: The schedule is A: 0–2, B: 2–4, C: 4–5, B: 5–7, A: 7–12. Waiting times are 5, 1, and 0, giving average ; the tempting 3 mixes waiting and turnaround.
Q5. Three jobs arrive at time 0 with CPU bursts P1=5, P2=3, and P3=1. Round Robin uses quantum 2. The Gantt chart is P1: 0–2, P2: 2–4, P3: 4–5, P1: 5–7, P2: 7–8, P1: 8–9. What is the average waiting time?
📖 Explanation: Completion times are 9, 8, and 5, so waiting times equal completion minus burst: 4, 5, and 4. Their mean is . The tempting is average turnaround, not waiting.
Q6. A database batch queue uses non-preemptive SJF. A long report job repeatedly waits while short queries arrive and are selected first. Which policy change most directly reduces the risk that the report waits indefinitely?
📖 Explanation: Aging raises the priority of a job as its waiting time grows, eventually allowing the report to run. The tempting choice of admitting more short queries worsens starvation rather than addressing it.
Q7. An interactive terminal process frequently blocks for keyboard input, while a CPU-intensive simulation consumes long bursts. In a multilevel feedback queue, which behavior is most consistent with favoring interactive responsiveness?
📖 Explanation: Interactive jobs commonly yield or block quickly, so feedback scheduling tends to keep them in higher-priority queues. The tempting permanent-highest placement for CPU-heavy work would let long bursts monopolize service.
Q8. A concurrent program protects a shared queue using a monitor. Which monitor property most directly prevents two threads from executing its protected operations at the same time?
📖 Explanation: A monitor provides implicit mutual exclusion for its procedures, so only one thread executes monitor code at once. The tempting claim about concurrent entry defeats that protection; condition variables coordinate waiting and notification.
Q9. A print service has a buffer of N slots shared by producer and consumer threads. Which initial semaphore values correctly represent available slots, filled slots, and exclusive buffer access, respectively?
📖 Explanation: Initially every slot is empty, no item is available, and the mutex must permit one thread into the critical section. Thus empty=N, full=0, mutex=1; reversing empty and full misstates buffer occupancy.
Q10. Two processes execute Peterson's algorithm with flag[i] and turn. Both set their flags to true; afterward turn is set to 0. Assuming the standard entry protocol, which process can enter the critical section first?
📖 Explanation: Process 1 waits while flag[0] is true and turn equals 0, whereas process 0 tests whether turn equals 1. The latter condition is false, so process 0 enters; mutual exclusion prevents both entering.
Q11. Five dining philosophers each pick up the fork on their left before requesting the fork on their right. All five acquire one fork and wait forever. Which design change prevents this deadlock by breaking circular wait?
📖 Explanation: A total order forces every philosopher to acquire forks in one global direction, preventing a circular wait chain. The tempting repeated retry preserves the cycle because each philosopher still holds one fork while waiting.
Q12. A resource-allocation graph contains a directed cycle, and at least one resource type in the cycle has multiple identical instances. A student concludes that deadlock is certain. What is the flaw in that conclusion?
📖 Explanation: For multiple resource instances, a cycle is necessary but not sufficient for deadlock because another instance may satisfy a waiting process. The tempting single-instance rule cannot be applied unchanged to this graph.
Q13. A system has two resource types and three processes. Available=(0,1). Allocation P0=(1,0), P1=(0,1), P2=(0,0). Need P0=(0,1), P1=(1,0), P2=(1,0). Which listed sequence is safe?
📖 Explanation: Only P0 can initially finish with available (0,1), releasing (1,0) to make (1,1). P1 then finishes, followed by P2; the tempting P1-first sequence is blocked by its unmet first resource.
Q14. A memory allocator manages variable-sized contiguous free regions. After repeated allocations and releases, total free memory is sufficient for a request, but no single free region is large enough. Which problem is occurring?
📖 Explanation: External fragmentation leaves free memory divided among separated holes, preventing a large contiguous allocation despite sufficient total capacity. Internal fragmentation instead wastes space inside an allocated region, so it does not fit.
Q15. A machine uses 32-bit logical addresses, 4 KiB pages, and one 4-byte page-table entry per virtual page. What is the size of a single-level page table covering the entire logical address space?
📖 Explanation: The page offset uses 12 bits, leaving 20 page-number bits and entries. At 4 bytes each, the table occupies MiB; the tempting 1 MiB omits entry size from the table total.
Q16. A CPU uses a TLB with a 90% hit ratio. TLB lookup takes 10 ns and memory access takes 100 ns. On a miss, one page-table memory access and one data access are needed. What is the effective access time, assuming serial lookup?
📖 Explanation: Hits cost ns; misses cost ns. The weighted time is ns. The tempting 119 ns is wrong because the miss path includes an additional page-table access in this case.
Q17. A process has a page-fault rate of . A normal memory access takes 200 ns, and a page fault, including service and restart overhead, takes 8 ms. Using , what is the approximate effective access time?
📖 Explanation: Convert 8 ms to 8,000,000 ns. Then ns, about 8.2 microseconds. The tempting 0.2 microseconds ignores fault service, which dominates despite rare faults, because each miss incurs the full service delay.
Q18. A database buffer pool has three frames and uses LRU replacement. For the reference string 1, 2, 3, 1, 4, 1, 2, 3, how many page faults occur, starting with empty frames?
📖 Explanation: References 1, 2, and 3 fault; 1 hits; 4 replaces least-recently-used 2; 1 hits; then 2 replaces 3 and 3 replaces 4. Thus six references fault; counting every reference is incorrect.
Q19. A virtual-memory engineer wants a page-replacement policy that cannot exhibit Belady's anomaly when the number of frames increases. Which policy has this guarantee?
📖 Explanation: LRU is a stack algorithm: the pages retained with fewer frames form a subset of those retained with more frames. Therefore adding frames cannot increase its fault count; FIFO lacks this guarantee.
Q20. A workstation becomes sluggish as more memory-intensive applications are admitted. The CPU spends most of its time servicing page faults rather than executing application instructions. Which response best addresses the underlying condition?
📖 Explanation: Thrashing occurs when active working sets exceed available frames, causing repeated page faults. Reducing multiprogramming can restore locality; admitting still more processes intensifies memory pressure and worsens the fault cycle.
Q21. A file system uses indexed allocation with 1 KiB blocks. Each index entry occupies 4 bytes, and one index block contains only data-block pointers. What is the maximum file size addressable by one index block?
📖 Explanation: The index block holds pointers. Each pointer addresses one 1 KiB data block, so the maximum is KiB, or 256 KiB; 1 MiB incorrectly assumes 1024 pointers instead of 256.
Q22. A file system stores metadata in an inode and uses a hierarchical directory tree. Which item is normally recorded in the inode rather than being the directory entry's filename-to-inode association?
📖 Explanation: An inode stores metadata such as ownership, permissions, timestamps, size, and block locations. A directory maps names to inode numbers, so the filename itself is not normally an inode field.
Q23. A shared database catalogue allows many readers or one writer at a time. A reader-preference readers-writers lock is used, and a continuous stream of readers arrives. Which risk can this policy create?
📖 Explanation: Reader preference admits readers while no writer holds the lock, potentially delaying a waiting writer indefinitely under continuing reader arrivals. The tempting simultaneous-writer outcome violates the lock's exclusion rule, not merely its fairness.
Q24. A disk head is at cylinder 50. The pending requests are 82, 170, 43, 140, 24, 16, and 190. SSTF selects the closest pending request each time. What is the total head movement?
📖 Explanation: SSTF visits 43, 24, 16, 82, 140, 170, and 190. Movement is cylinders. The tempting 228 adds an incorrect distance; the final jump is only 20 cylinders for that final request.
Q25. A disk has cylinders 0 through 199. The head is at 50 and moving upward; requests are at 30, 60, and 90. A student says SCAN reverses at 90 like LOOK and reports 100 cylinders. Which correction is accurate?
📖 Explanation: The flawed step is treating SCAN like LOOK. SCAN travels to 199, then down to 30: . LOOK reverses at 90, so its path totals 100 cylinders; the tempting 100 applies only to LOOK.
Q26. A network interface transfers a large received packet directly into a memory buffer using DMA, then notifies the CPU when the transfer finishes. What work does DMA primarily save the CPU from performing?
📖 Explanation: DMA lets the device controller transfer a block directly between the device and memory, avoiding CPU-managed copying for each byte. An interrupt may still signal completion, so DMA does not eliminate all CPU work.
Q27. A process makes a system call, causing execution to move from user mode to kernel mode. The kernel services the call and returns to the same process without scheduling another process. Which statement is correct?
📖 Explanation: The privilege transition is a mode switch; the same process can continue after the service completes, so no process context switch is necessary. The tempting claim that every system call switches processes confuses privilege with identity.
Q28. A monitoring system records CPU utilization against the degree of multiprogramming: (1,20%), (2,38%), (4,68%), (8,90%), (12,92%), (16,70%). At which measured degree does adding more processes first correspond to lower CPU utilization?
📖 Explanation: Utilization rises from 20% to 92% through degree 12, then falls to 70% at degree 16. The tempting 12 marks the peak, not the first decline as more jobs are admitted.
Q29. A FIFO page-replacement experiment records frame count and page faults as follows: 1 frame: 9 faults ; 2 frames: 7 faults ; 3 frames: 8 faults ; 4 frames: 6 faults ; 5 frames: 5 faults. Which observation demonstrates Belady's anomaly?
📖 Explanation: Belady's anomaly is shown because increasing frames from two to three raises faults from seven to eight. The other listed transitions reduce faults, so they do not illustrate the anomaly.
Q30. An inode has 10 direct pointers, one single-indirect pointer, and one double-indirect pointer. The block size is 1 KiB and each pointer is 4 bytes. Ignoring metadata overhead, what is the maximum addressable file size?
📖 Explanation: Each index block holds pointers. Addressable data blocks are , giving 65,802 KiB. The tempting 65,546 KiB omits the ten direct data blocks, each of which addresses 1 KiB.