📝 Kernel I/O subsystem summary (8 MCQs)
Shared Kernel Responsibilities in Device Management
The kernel I/O subsystem coordinates application requests, device drivers, controllers, and completion handling. It supplies common services such as request validation, buffering, caching, scheduling, device protection, and error reporting. These facilities allow different hardware devices to be managed through structured interfaces while preserving access control and coordinating competing requests.
How the Main I/O Services Complement One Another
Drivers translate generic requests into device-specific operations. Queues organise pending work, scheduling selects requests, and buffers coordinate data movement. Caches retain reusable data, while spooling manages delayed jobs for shared devices. Protection restricts access, and error handling reports or recovers from failures. These mechanisms solve different problems and should not be treated as interchangeable.
Tracing a Request Through Kernel Components
An application submits an operation through a system call. The kernel validates access, checks whether cached data can satisfy the request, and otherwise creates a request record. The request may enter a queue before dispatch to the driver. Hardware performs the operation, and completion handling updates state and returns the result.
Example of a Cached and Scheduled Disk Read
Process P1 requests a file block. If the block is already cached, the kernel can provide it without a device operation. On a cache miss, the kernel submits a storage request, which may wait in a queue. The driver starts the read, and completion makes the new block available to P1.
Balancing Performance, Reliability and Protection
Kernel I/O services improve throughput, responsiveness, resource sharing, and device reliability. Their effectiveness depends on suitable scheduling, cache policies, buffer sizes, and error recovery. Extra layers introduce memory use and processing overhead, so systems must balance efficiency against complexity. Device technology and workload characteristics determine which mechanisms provide the greatest benefit.
Misconceptions About Kernel I/O Components
'Buffering and caching solve the same problem' is false because temporary transfer coordination differs from reuse of stored data. 'Every request is immediately executed by a driver' ignores queues and cache hits. 'An interrupt guarantees successful I/O' is incorrect because completion notifications can report errors as well as success.
Exam Focus: Connecting Kernel I/O Mechanisms
Be able to distinguish drivers, queues, buffers, caches, spooling, and error handlers. Trace both cache-hit and cache-miss paths and explain where scheduling occurs. Questions may combine protection, device sharing, and completion notification, requiring an explanation of how separate kernel components cooperate during one I/O request.
Key Terms of Kernel I/O Management
- Driver - Device-specific kernel software.
- Queue - Holds pending I/O requests.
- Buffer - Temporarily holds transfer data.
- Cache - Retains data for reuse.
- Completion handler - Processes finished I/O operations.
📝 All Kernel I/O subsystem summary MCQs
Q1. Which range of interrupt vector numbers is reserved for non‑maskable events?
📖 Explanation: The correct answer is A because vectors 0 through 31 are defined by the Intel architecture as non‑maskable, meaning they cannot be disabled by software and are used for critical exceptions such as divide‑error or machine‑check. Vectors 32‑255 are maskable and are typically assigned to external device interrupts. Options B, C, and D either describe maskable ranges or overlap incorrectly, so they are wrong. Understanding these ranges helps the OS map handlers correctly.
Q2. What is the primary purpose of having interrupt priority levels in a CPU?
📖 Explanation: The correct answer is B. Interrupt priority levels let the CPU decide which interrupt can run while another is in progress. A high‑priority interrupt can pre‑empt a lower‑priority service routine, ensuring urgent events are handled promptly without disabling all interrupts. Option A is wrong because low‑priority interrupts are not ignored; they can be deferred. Options C and D describe unrelated effects, so they are incorrect.
Q3. A device generates an interrupt at vector 45 while the CPU is already handling an interrupt at vector 10. Which statement correctly describes the CPU’s behavior?
📖 Explanation: The correct answer is B. Vector numbers 32‑255 are maskable, but priority is determined by the specific vector assigned; typically higher numbers indicate higher priority, and the CPU will suspend the current lower‑priority ISR to service the higher‑priority interrupt. Option A would delay the urgent device, which defeats the purpose of priority. Option C is impossible on a single‑core CPU without special hardware. Option D incorrectly suggests masking, which the CPU does not do for higher‑priority interrupts.
Q4. During I/O, a driver receives an interrupt indicating that a write operation has completed. What should the driver do first?
📖 Explanation: The correct answer is C. After receiving a completion interrupt, the driver must read the device’s status register to verify that the write succeeded and to clear the interrupt condition. Immediately scheduling a user process (A) may be premature, resetting the device (B) could disrupt normal operation, and ignoring the interrupt (D) would waste the signal. Therefore, checking the status ensures correct I/O handling.
Q5. An operating system discovers that two devices share the same IRQ line. Which strategy must the OS employ to correctly handle interrupts from both devices?
📖 Explanation: The correct answer is B. When two devices share an IRQ line, the OS must allow multiple interrupt handlers to be linked to the same vector and invoke each in turn, often by checking device‑specific status registers. Assigning unique vectors (A) is not possible without hardware changes. Disabling maskable interrupts (C) would halt all normal I/O, and converting to a non‑maskable interrupt (D) is not supported and would jeopardize system stability. Shared‑interrupt handling preserves correct operation.
Q6. How does the interrupt mechanism distinguish between processor exceptions such as divide‑by‑zero and regular device‑generated interrupts?
📖 Explanation: The correct answer is A. Processor exceptions occupy vectors 0‑31 and are non‑maskable, meaning they cannot be turned off and are reserved for critical faults like divide‑by‑zero. Device‑generated interrupts use vectors 32‑255, which are maskable and can be enabled or disabled by software. Option B reverses the maskability, option C suggests a flag that does not exist in the Intel design, and option D ignores the distinct handling, making them incorrect.
Q7. Why does the operating system install interrupt handlers into the interrupt vector during boot time?
📖 Explanation: The correct answer is B. During boot, the OS probes hardware, determines which devices are present, and registers appropriate handlers at specific vector entries so that when a device raises an interrupt, the CPU can quickly jump to the correct routine. Option A is unrelated to interrupt handling, option C is false because interrupts are necessary for I/O, and option D misstates the effect of installing handlers. Prompt handler installation is essential for responsive I/O.
Q8. If a high‑priority interrupt arrives while a low‑priority interrupt service routine (ISR) is executing, what happens to the low‑priority ISR?
📖 Explanation: The correct answer is B. When a higher‑priority interrupt arrives, the CPU saves the state of the currently running low‑priority ISR, services the high‑priority one, and then restores the saved state to resume the low‑priority ISR. Option A would ignore priority, option C would lose work and require restarting, and option D describes a different mechanism not used for simple ISR pre‑emption. This behavior ensures urgent tasks are addressed promptly while preserving the original ISR work.