chapter 36 - I/O devices Flashcards
(14 cards)
What are the main components of classical system architecture and how are they connected?
- CPU and RAM: Connected via a high-speed memory bus
- I/O Bus: Connects medium-speed devices
- Peripheral Bus: Connects slow-speed devices via interfaces like USB
- High-speed devices → closer to CPU
- Low-speed devices → further from CPU
Why is hardware organized hierarchically in a computer system?
Due to physical and cost constraints:
- fast buses must be short
- slower buses allow many low-cost devices to connect
What is a canonical device in OS design?
device used to explain how hardware interacts with software - not a real device
Describe the canonical protocol between OS and device using polling.
status(read only) - tells the OS wether device is busy/ready/done
command(write only) - tells the device what to do
data(read/write) - allows OS to send or receive dataw
what are the 2 components in any device - explain
hardware interface - registers and protocols used by the OS to control it - how the OS talks to the hardware
internal structure - hidden by the OS - includes: small CPU, RAM
what is the problem with polling
CPU keeps checking device status in a loop - This wastes CPU cycles + no other process can run
what is polling
OS keeps checking the status register in a loop
what is programmed I/O (PIO)
the CPU itself is doing all the reading/writing
how can interrupts help the polling problem
OS sends the command → puts process to sleep → runs other tasks
When the device finishes, it raises an interrupt
invoking an ISR to resume the waiting process - Interrupt Service Routine (ISR)
What is Direct Memory Access (DMA) and how does it improve performance?
DMA transfers data between memory and device without CPU involvement
- CPU kjører prosess 1(før I/O starter)
- DMA starter kopi av data fra minne til disk (c c c)
- Disk starter I/O parallelt
- CPU er fri og kjører prosess 2 mens DMA+disk jobber
- Når I/O er ferdig, får prosess 1 CPU igjen
se figur i notater
Compare Programmed I/O (PIO) with DMA
PIO: CPU does all the copying, wasting cycles
DMA: a dedicated engine handles the copy, allowing CPU to multitask
What are the two main methods the OS uses to interact with devices?
Explicit I/O instructions — Special CPU instructions used to interact directly with device registers
Memory-mapped I/O — uses regular memory operations (load/store) to access device registers
What is a device driver and why is it important?
software that knows how to control a specific device – OS talks to the driver, not the hardware directly
allows the OS to be device-neutral
ID disk interface - uses 4 types of registers
- Control
- Command Block
- Status
- Error