W5 - Disks and IO Flashcards
(87 cards)
What hides the complexity of storage devices from us?
File systems
Is there any guarantee our files will be stored in contiguous locations on the disk?
No. Our files are bits of data most likely spread over many different parts of the storage device (e.g. sectors of a HDD).
What does Input/Output refer to?
The communication between the processor and external devices.
What do I/O controllers do?
They serve as intermediaries between the processor and I/O devices. They implement buffering to smooth out speed differences between fast CPU operations and slower device operations.
How are I/O controllers connected to storage devices?
Physically, via wires.
How does the CPU interact with I/O controllers?
By reading/writing to I/O registers, as if they were memory.
How can controllers signal the processor?
Via interrupts.
What is a DMA transfer?
Allows data movement between memory and storage without constant CPU involvement. Without this, the CPU would waste cycles waiting for slow devices.
L1/L2 vs L3 cache
Each core gets its own L1/L2 cache. L3 cache is shared across all cores.
What can controllers be thought of as?
Little brains with dedicated purpose
What controller connects the processor and memory?
Bridge/memory controller
What do controllers follow to enable communication with each other?
Protocols.
What is a bus?
A set of wires for communication among devices plus protocols for data transfer operations.
Name external connection universal bus standards
IDE/ATA, SATA, PCI Express
What is a cache in the context of a disk controller?
A data buffer which temporarily stores information to improve performance.
What role do drivers play in HDD controllers?
They can communicate with different disk interfaces.
What kind of information will a HDD controller cache?
Neighbouring sectors from where head is reading.
Recently accessed blocks.
What are the typical tasks of a HDD controller?
Read/write operations
Validation and error correction
Communicating with CPU
Describe the set of steps in a typical interaction between OS and an I/O device.
- The OS uses the status register to detect when the device is NOT BUSY
- The OS writes into the data register and sets the command register.
- The controller sets the status to BUSY
- The controller reads the command and the data register, and launches the execution of the command.
- The OS detects when the command has been executed based on the status register. The controller therefore clears the command, and resets its BUSY status once the command is executed. It sets status to ERROR if needed.
How does Memory Mapped I/O work?
Specific addresses in the main memory are reserved for I/O devices.
What are the two methods that enable the OS to know when an I/O device has completed an operation or encountered an error?
I/O Interrupt
Polling
How do I/O interrupts work?
The device generates an interrupt whenever it needs service.
Pros/Cons of I/O interrupts
Pro: Handles unpredictable events well
Con: Interrupt has relatively high overhead (saving/loading contexts costs many instructions)
How does Polling work?
The IO device puts completion info in a status register. The OS periodically checks the device specific status register (basically saying “are you done yet?”).