🎓 BookMCQ
← Back to 13. I/O Systems

📝 I/O scheduling in Kernel I/O Subsystem (11 MCQs)

Ordering Pending Requests for Device Service

I/O scheduling determines the order in which pending requests are submitted to a device. In operating systems, it is particularly important for storage devices, where request order can affect seek movement, throughput, and response time. The kernel maintains request queues and applies scheduling policies to balance efficiency, fairness, and the needs of competing processes.

Why Request Arrival Order May Be Inefficient

Requests can arrive in an order that causes unnecessary mechanical movement on hard disk drives or creates poor queue utilisation. Processing strictly by arrival time is simple but may increase total service time. Scheduling policies attempt to reduce movement or improve responsiveness, although the best policy depends on device technology and workload.

Applying Scheduling Policies to a Request Queue

The kernel collects requests containing device addresses and operation details. A scheduler selects the next request according to a policy such as FCFS, SSTF, SCAN, C-SCAN, LOOK, or C-LOOK. The selected request is dispatched to the device driver, and the queue is updated as requests complete or new ones arrive.

Example of Disk Head Movement

Assume a hard disk head starts at cylinder 50, with queued requests for 20, 70, and 90. FCFS services them in arrival order, while SSTF chooses the nearest request first. Depending on the arrival order, SSTF may reduce total movement, but repeated arrival of nearby requests can delay distant requests.

Throughput, Latency and Fairness Trade-Offs

Disk scheduling can reduce seek time and improve throughput on mechanical drives. Algorithms that prioritise nearby requests may increase waiting time for distant requests, while sweep algorithms offer more systematic service. SSDs have no mechanical seek arm, so traditional cylinder-based policies are less directly relevant; modern schedulers also consider fairness, merging, and device queues.

Misconceptions About I/O Scheduling Policies

'SSTF always gives the shortest total movement' is false because a locally nearest choice may not produce a global optimum. 'SCAN and C-SCAN move in exactly the same service pattern' ignores C-SCAN's one-direction service. 'Disk scheduling is equally useful for every storage device' overlooks the different latency characteristics of SSDs.

Exam Focus: Calculating Disk Scheduling Results

Practise tracing FCFS, SSTF, SCAN, C-SCAN, LOOK, and C-LOOK using a given initial head position, request queue, and direction. Calculate total head movement by summing cylinder differences. State boundary assumptions clearly, because SCAN and C-SCAN results depend on whether the head travels to the physical disk end.

Key Terms of I/O Scheduling

  • Request queue - Collection of pending device operations.
  • FCFS - Services requests in arrival order.
  • SSTF - Selects the nearest pending request.
  • SCAN - Services requests during directional sweeps.
  • Seek time - Time required to position a disk head.
2
Easy
5
Medium
4
Hard

📝 All I/O scheduling in Kernel I/O Subsystem MCQs

Q1. Which vector number range is designated for maskable interrupts on the Intel Pentium processor?

A.0–31
B.32–255 ✅
C.0–15
D.16–63
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The Intel Pentium defines maskable interrupts in the range 32−25532-255. These interrupts can be enabled or disabled by software, allowing the OS to control device‑generated signals. Non‑maskable interrupts occupy 0−310-31 and are always serviced. Choosing the correct range is essential for proper interrupt handling, and only option B matches the documented maskable range.

Q2. Why are interrupt priority levels important for an operating system?

A.They allow the CPU to ignore all interrupts when busy
B.They guarantee that low‑priority devices never interrupt the CPU
C.They enable high‑priority interrupts to pre‑empt lower‑priority ones ✅
D.They simplify the design of device drivers
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Interrupt priority levels let the CPU defer less urgent work while still responding quickly to critical events. When a high‑priority interrupt arrives, it can interrupt a lower‑priority handler, ensuring timely handling of important tasks. This selective pre‑emption improves system responsiveness, whereas the other choices either misstate the function or oversimplify the mechanism.

Q3. During system boot, the OS probes hardware buses and installs interrupt handlers. What is the primary purpose of this step?

A.To allocate memory for device buffers ✅
B.To map device I/O ports into user space
C.To associate each device’s interrupt vector with a specific service routine
D.To disable all maskable interrupts until drivers load
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Installing handlers links each device’s interrupt vector to a routine that will run when the device signals an event. This association enables the OS to quickly respond to I/O completion or error conditions. The other options describe unrelated activities such as memory allocation, user‑space mapping, or globally disabling interrupts, which are not the main goal of handler installation.

Q4. A low‑priority disk controller raises an interrupt, but a high‑priority timer interrupt arrives shortly after. Which outcome best describes the system behavior?

A.The timer interrupt is ignored until the disk interrupt finishes
B.The disk interrupt handler is pre‑empted, and the timer handler runs immediately
C.Both interrupts are queued and handled after the current routine completes
D.The OS disables the timer interrupt to finish the disk service ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: When a higher‑priority interrupt occurs, the CPU saves the state of the lower‑priority handler and jumps to the higher‑priority routine. This pre‑emption ensures the timer’s time‑critical task is performed promptly. The other statements either block the higher‑priority interrupt, delay both, or mistakenly claim the OS disables the timer, which would violate priority semantics.

Q5. If the operating system fails to install a handler for a maskable interrupt generated by a network card, what is the most likely result?

A.The network card will stop sending data
B.The CPU will halt completely
C.The interrupt will be ignored, causing missed packets ✅
D.The system will automatically assign a default handler
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Without a registered service routine, the CPU receives the interrupt signal but has no code to execute, so the event is effectively ignored. Consequently, incoming packets may be missed, degrading network performance. The other outcomes—hardware shutdown, CPU halt, or automatic default handling—do not reflect typical OS behavior when a handler is absent.

Q6. A device driver enables nested interrupts, allowing a high‑priority interrupt to pre‑empt a lower‑priority one. Which stack operation must occur first when the high‑priority interrupt is taken?

A.Push the low‑priority program counter onto the stack
B.Pop the high‑priority return address from the stack
C.Push the high‑priority return address onto the stack ✅
D.Clear the interrupt flag in the CPU status register
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: When a higher‑priority interrupt occurs, the CPU saves the return address of the current (low‑priority) handler by pushing the high‑priority return address onto the stack before jumping to the new routine. This preserves the execution context for later resumption. The other options describe actions that happen later or are unrelated to the initial interrupt entry sequence.

Q7. Why are non‑maskable interrupts (NMIs) designed to be always enabled and not disableable by software?

A.To allow user programs to control critical hardware
B.Because they represent minor errors that can be ignored
C.To ensure that catastrophic hardware failures are reported immediately ✅
D.To simplify the interrupt vector table
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: NMIs signal severe conditions such as hardware failures that require immediate attention regardless of the current CPU state. By keeping them always enabled, the system guarantees that these critical events cannot be masked, preserving system integrity. The other choices either mischaracterize NMIs as minor, give control to user programs, or incorrectly claim simplification of the vector table.

Q8. Multiple devices generate maskable interrupts at the same time. The interrupt controller assigns priorities based on vector numbers. Which device’s interrupt will be serviced first?

A.The device with the lowest vector number ✅
B.The device with the highest vector number
C.The device that was initialized last
D.The device with the shortest service routine
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Interrupt controllers typically prioritize lower vector numbers, treating them as higher priority. Thus, when several devices signal simultaneously, the CPU will handle the interrupt whose vector is numerically smallest first. The other options—highest number, initialization order, or routine length—do not reflect the standard priority scheme used in the Pentium architecture.

Q9. What role does the interrupt vector table play in I/O scheduling?

A.It stores data packets awaiting processing
B.It maps each interrupt number to its corresponding handler address ✅
C.It records the time each interrupt occurs
D.It provides a list of all connected I/O devices
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The interrupt vector table is a lookup structure that associates every possible interrupt number with the memory address of its service routine. When an interrupt occurs, the CPU uses the vector to find the correct handler quickly. The other options describe functions unrelated to the vector table, such as buffering data, time‑stamping, or device enumeration.

Q10. A storage controller signals completion of a write operation via an interrupt. Which sequence correctly describes the OS actions after receiving the interrupt?

A.Disable all other interrupts, write data to disk, re‑enable interrupts
B.Read the status register, acknowledge the interrupt, wake waiting processes ✅
C.Immediately reboot the system to clear the interrupt flag
D.Ignore the interrupt and poll the device later
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Upon receiving the interrupt, the OS typically reads the controller’s status register to determine success, acknowledges the interrupt to prevent re‑triggering, and then wakes any processes waiting for the write to finish. This ensures efficient handling without unnecessary delays. The other options either misuse interrupt disabling, cause an unnecessary reboot, or revert to polling, which defeats the purpose of the interrupt.

Q11. Why might a system designer choose polling over interrupt‑driven I/O in certain scenarios?

A.Polling guarantees zero latency for all devices
B.Interrupts consume more CPU cycles than continuous polling
C.Polling can simplify hardware design when interrupt overhead outweighs benefits ✅
D.Polling eliminates the need for an interrupt vector table
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Polling may be preferred when the overhead of handling frequent interrupts exceeds the simplicity gained by continuously checking device status, especially for low‑throughput or predictable devices. While polling can increase CPU usage, it can reduce complexity in hardware and driver code. The other statements either misstate latency, incorrectly claim polling uses fewer cycles, or ignore the necessity of an interrupt vector table.

🔗 Related Topics (MCQs)