🎓 BookMCQ
← Back to 13. I/O Systems

📝 Kernel data structures in Kernel I/O Subsystem (8 MCQs)

Data Structures for Managing I/O Resources

The kernel I/O subsystem uses data structures to represent devices, drivers, open requests, buffers, queues, and completion states. These structures allow the operating system to track which operations are pending, which resources are available, and how requests relate to processes and hardware. Their organisation supports efficient lookup, coordination, error handling, and device-independent management.

Why I/O State Must Be Represented in the Kernel

Several processes may request the same device, and one operation can remain active while others wait. The kernel must preserve request parameters, transfer progress, buffer locations, and completion status. Without organised structures, it would be difficult to coordinate concurrent operations, resume interrupted work, or identify the process that should receive a result.

Device Tables, Request Queues and Buffer Records

Device tables describe registered devices and their associated drivers or status. Request queues hold pending operations, while per-request structures record details such as the operation type, target address, buffer, and state. Buffer and cache metadata track memory areas containing transfer data. Completion handlers update these records before waking waiting tasks or signalling results.

Example of Two Requests Waiting for One Device

Suppose process P1 requests block 40 and P2 requests block 85 from the same disk. The kernel creates separate request records and places them in the device queue. The scheduler selects a request for execution. When it completes, the kernel updates its status, notifies P1, and processes the remaining request.

Concurrency, Lookup Costs and Memory Use

Well-designed structures support quick request lookup, controlled queue updates, and efficient buffer management. Linked lists, trees, hash tables, and arrays may be used according to workload and implementation needs. Concurrent updates require synchronisation, while excessive metadata increases memory use. Real operating systems use more complex structures than a simplified textbook device table.

Misconceptions About Kernel I/O Structures

'A device table stores all transferred file contents' confuses device metadata with data buffers and caches. 'Every I/O request is stored in one universal queue' is false because systems maintain queues at different layers and for different devices. 'Queue entries never change after submission' ignores updates to progress, completion, and error state.

Exam Focus: Tracking Requests and Device Metadata

Identify the purpose of device tables, request queues, buffer descriptors, and completion records. Trace how two processes create and update separate requests for one device. Questions may ask which fields must be preserved during an I/O operation or how synchronisation prevents concurrent queue updates from corrupting kernel state.

Key Terms of Kernel I/O Data Structures

  • Device table - Records registered device information.
  • Request queue - Holds operations awaiting execution.
  • Request record - Stores details of one I/O operation.
  • Buffer descriptor - Identifies a memory transfer area.
  • Completion state - Records the outcome of a request.
2
Easy
4
Medium
2
Hard

📝 All Kernel data structures in Kernel I/O Subsystem MCQs

Q1. What is the range of vector numbers reserved for non‑maskable interrupts in the Intel Pentium processor?

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

📖 Explanation: The correct answer is A because non‑maskable interrupts occupy vectors 0 through 31, as defined by the processor architecture. Option B describes the maskable range, while C and D are incorrect sub‑ranges. Knowing the correct range helps the OS place critical exception handlers, ensuring that fatal errors are caught immediately without being disabled.

Q2. Why does the interrupt priority level mechanism allow a high‑priority interrupt to preempt a low‑priority one without masking all interrupts?

A.It forces the CPU to ignore low‑priority interrupts entirely
B.It enables selective masking based on priority levels ✅
C.It queues low‑priority interrupts for later processing
D.It disables the interrupt flag during the entire service routine
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct answer is B because the priority system lets the CPU mask only those interrupts whose priority is lower than the current level, leaving higher‑priority requests able to interrupt. Option A is wrong because low‑priority interrupts are not ignored; they are delayed. Option C describes a different mechanism (queueing) not used here. Option D would halt all interrupts, defeating responsiveness.

Q3. How does the operating system use the interrupt vector during boot time?

A.It scans the vector to detect hardware errors
B.It probes hardware buses and installs handlers at specific vector entries ✅
C.It disables all vectors until devices are initialized
D.It randomizes vector assignments to improve security
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct answer is B. During boot, the OS probes buses to discover devices and writes the address of each device’s service routine into the appropriate vector slot, ensuring that later interrupts are dispatched correctly. Option A confuses error detection with vector usage. Option C would prevent any interrupt handling. Option D is not a standard practice and would break deterministic interrupt routing.

Q4. A disk controller raises interrupt vector 46 indicating data ready. The current interrupt service routine is handling vector 12 (a low‑priority timer). Which action should the CPU take?

A.Complete vector 12 before handling vector 46
B.Immediately preempt vector 12 and start vector 46 ✅
C.Ignore vector 46 until vector 12 finishes
D.Queue vector 46 behind all lower‑priority interrupts
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct answer is B because vector 46 has a higher priority than the timer’s vector 12, so the CPU preempts the low‑priority routine to service the urgent I/O request. Option A would delay data processing, risking buffer overflow. Option C would discard the interrupt. Option D would treat it as low priority, which contradicts the priority scheme.

Q5. If a high‑priority interrupt with vector 20 occurs while the CPU is servicing a maskable interrupt at vector 60, what will the CPU do?

A.Continue servicing vector 60 and handle vector 20 later
B.Immediately suspend vector 60 and service vector 20 ✅
C.Mask vector 20 until vector 60 completes
D.Treat both interrupts as equal and service them concurrently
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The correct answer is B. Vector 20 belongs to the non‑maskable range (0–31) and has higher priority, so the CPU aborts the current maskable service routine (vector 60) and jumps to the higher‑priority handler. Option A ignores priority rules. Option C is impossible because non‑maskable interrupts cannot be masked. Option D is not feasible; the CPU handles one interrupt at a time.

Q6. An OS mistakenly registers a page‑fault handler at a maskable vector (e.g., vector 50). What is the most likely outcome when a page fault occurs?

A.The page‑fault handler will be invoked correctly
B.The CPU will treat the fault as a maskable interrupt and may ignore it
C.A general protection fault will be raised, potentially crashing the system ✅
D.The interrupt will be silently discarded
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The correct answer is C because page faults are defined as non‑maskable exceptions (vector 14). Placing the handler at a maskable slot means the CPU will not invoke it for a fault; instead, the mismatch triggers a general protection fault, often leading to a system crash. Option A is wrong because the CPU looks for the handler at the predefined vector. Option B misstates the CPU behavior; non‑maskable faults cannot be treated as maskable. Option D is inaccurate; the interrupt is not silently discarded.

Q7. What is the primary purpose of maskable interrupts (vectors 32–255) in an operating system’s I/O subsystem?

A.To handle critical processor exceptions
B.To allow device‑generated interrupts to be selectively enabled or disabled ✅
C.To provide a fixed mapping for system calls
D.To replace the need for polling mechanisms
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct answer is B because maskable interrupts let the OS enable or disable specific device interrupts, controlling I/O flow without disabling all interrupts. Option A describes non‑maskable exceptions. Option C confuses interrupts with system call vectors. Option D is false; polling is an alternative technique, not replaced by maskable interrupts.

Q8. Why is it important for the operating system to install interrupt handlers before any device generates an interrupt?

A.To ensure the CPU can ignore the interrupt
B.To prevent the interrupt from being routed to an undefined address ✅
C.To allow the interrupt to be logged automatically
D.To enable the device to reset itself
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The correct answer is B because without a valid handler, the CPU would jump to an undefined address, causing a crash or undefined behavior. Option A is incorrect; the CPU cannot simply ignore a pending interrupt. Option C is unrelated to handler installation. Option D misrepresents the role of the handler; resetting the device is not the purpose of the interrupt vector.

🔗 Related Topics (MCQs)