131 Week 6 - IO System Flashcards
Function of the input output system
Allows input and output devices to be attached to the processor
Speed gap challenge
Because I/O devices are often mechanical, they run orders of magnitude slower than the CPU. This means we need to make sure the CPU is not slowed down when it interacts with an I/O device e.g., fetching data from a hard disk.
Device diversity challenge
Devices are very diverse and we need to make sure all types of devices can be connected to the processor
Diversity of data access modes
Some devices are read-only or write-only or read-write.
Some devices access by the individual byte whereas some access by the block.
Some devices access data randomly but some access data sequentially.
Device specific operations
Some devices will have operations which can only happen to that device.
E.g., change resolution for screens, set time for clocks or focus for cameras.
I/O protocols
Data transfer errors can happen e.g., electric noise or wireless transmission can cause errors.
Devices can be synchronous or asynchronous
Device drivers
Software plugins inside the OS which abstract over device diversity by grouping sets of devices that “look the same”, allowing communication between the device and processor.
Functions of device drivers
Registering device with OS and initialising it.
Initiating data transfers to/from a device.
Monitoring status events from a device.
Managing device/system shutdown – ensure OS doesn’t stop until all unwritten data is stored and the device is left in a safe state.
What are the 2 device types
Character and block devices.
Character devices
Sends and receives 1 byte at a time, e.g., keyboard.
Block devices
Sends and receives a multi-byte block, e.g., hard disk.
Hard disk
Hard disks are block oriented devices.
The smallest unit of disk storage on a hard disk is called a sector - commonly 512 bytes in size.
Hard disks have multiple heads inside them. Each head is split up into tracks and each track contains multiple sectors.
Data is addressed at the device level as <head, cylinder, sector>.
What are the 2 types of processor support for I/O
Isolated I/O and memory-mapped I/O
Isolated I/O
I/O devices are assigned a separate address space, distinct from the memory address space.
Special instructions are used by the CPU to interact with the I/O devices.
Pros and cons of isolated I/O
+ Suited to simple devices
- Having fixed I/O instruction set
Memory mapped I/O
The I/O devices share the same address space as the system memory.
Regular memory instructions are used for both memory and I/O operations.
Pros and cons of memory mapped I/O
+ simply, flexible programming model
- adds complexity to devices - need to understand larger addresses and work at memory speeds.