file system components
interface
implementation
mass-storage structure: lowest level of the fs, the secondary and tertriary storage structures
block devices
hard disks, SSDs
store information in fixed-sized blocks
transfers are in units of entire blocks
I/O occurs with random access (by block ID)
character devices
printers, network interfaces
no blocks, only stream of characters/bytes
not addressable, doesn’t have any seek operation
I/O occurs with sequential access
device controller
port-mapped I/O
two address spaces: main memory + ports
I/O Registers are accessed via dedicated port numbers and special instructions
memory-mapped I/O
one address space
I/O Registers are mapped into addresses of main memory and accessed like memory
hybrid I/O
two address spaces
Both implementation can coexist on a given architecture
I/O requests
Most devices offer status bits in their registers to signal that a request has been finished (and the error code)
OS can poll this status bit (polling)
polling / busy waiting
after outputting a character, the CPU continuously polls the device to see if it is ready to accept another one
interrupts
Device controller can trigger interrupts to signal that an I/O request is complete
=> For the device, this means simply changing the voltage on an electrical interrupt line
- Each controller has interrupt vector assigned
- CPU runs vector-specific handler when int occurs
trap
deliberate action from a program, software interrupt
fault (exception)
usually not deliberate, typically caused by programs
hardware interrupt
device such as printer or network sends a signal to the CPU
precise <-> imprecise interrupts
precise: state is consistent- everything before the interrupt is executed and after isn’t
imprecise: doesn’t have the same guarantee
Data Exchange Between Device and CPU
DMA
hardware does the data transfer
DMA steps
DMA controller
issues in I/O software
device independence
uniform naming
error handling
errors should be handled closest to their source
buffers
networking: incoming packets have to be buffered
audio: buffering to avoid clicks
synchronous vs asynchronous