Normally user programs are prevented from handling I/O directly by I/O…
2005
Normally user programs are prevented from handling I/O directly by I/O instructions in them. For CPUs having explicit I/O instructions, such I/O protection is ensured by having the I/O instructions privileged. In a CPU with memory mapped I/O, there is no explicit I/O instruction. Which one of the following is true for a CPU with memory mapped I/O?
- A.
I/O protection is ensured by operating system routine (s)
- B.
I/O protection is ensured by a hardware trap
- C.
I/O protection is ensured during system configuration
- D.
I/O protection is not possible
Attempted by 234 students.
Show answer & explanation
Correct answer: A
Answer: I/O protection is ensured by operating system routine(s).
Key idea: In memory-mapped I/O devices are accessed through normal memory addresses rather than through special I/O instructions.
How protection is enforced: The operating system and device drivers control which virtual pages map to device registers. Only the kernel (or code the OS explicitly allows) gets those mappings; user programs do not have device pages mapped into their address space.
Role of hardware: The MMU enforces access permissions. If a user program attempts to access an unmapped or protected device address, the hardware generates a page fault/trap. This trap is a side effect of memory protection, not a dedicated I/O-instruction trap.
Why other statements are incorrect:
The idea that protection is ensured by a hardware I/O trap is misleading: without special I/O instructions the primary protection mechanism is OS-controlled mappings and MMU-enforced permissions; hardware traps can occur only when an illegal memory access happens.
System configuration alone does not provide runtime enforcement: configuration sets up mappings and permissions, but the OS and MMU enforce them while the system runs.
The statement that I/O protection is not possible is false: memory-mapped I/O systems commonly use virtual memory and OS/device-driver control to protect device access.