1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Input/Output System
Enables the attachment of input and output devices to the processor
Examples of Input Devices
keyboards
mice
track balls
touch screens
musical instruments
cameras
environmental sensors
Examples of Output Devices
displays
printers
speakers
environmental actuators
Examples of Input-and-Output Devices
network interfaces
ethernet
WIFI
bluetooth
disks
audio cards
MIDI devices
Connecting I/O Devices
I/O Challenge 1 - Speed-Gap Challenge
I/O devices are often mechanical, and therefore run orders of magnitude slower than the CPU
So how can we ensure that the CPU is not slowed down when it interacts with I/O devices (e.g. when fetching data from the hard disk)?
We can’t afford to waste CPU cycles
(with very slow CPUs and very fast devices the problem can be reversed - any difference in performance is a problem)
I/O Challenge 2 - Device Diversity Challenge
Devices are extremely diverse, e.g
Diversity of data-access modes
Device-specific operations
I/O protocol
Diversity of Data-Access Models
Read-only or write-only or read-and-write
Access by the individual byte or by the block/ by the stream
Access randomly (like a disk) or sequentially (like a tape)
Device-Specific Operations
Change the resolution (only for screens), set the time (only for clocks), focus (only for cameras)
I/O Protocol
We may need to be concerned with potential data transfer errors (e.g. from electrical noise, wireless transmission errors)
Synchronous or asynchronous
Device Drivers
These are software plug-ins inside the operating system
Their job is to abstract over device diversity by “grouping” sets of “somewhat similar” types of device; e.g.
Many devices can be made to “look like a mouse” to software
All hard disks are “essentially the same”
Example Functions of Device Drivers
Registering a device with the OS and initialising it
Initiating data transfers to or from a device
Monitoring status events from a device
Managing device/ system shutdown
Ensuring that the OS doesn’t “stop” until all unwritten data is stored, and the device is left in a safe state)
Traditional Two-Fold classification of Device Types (and Device Driver Types)
character devices
block devices
Character Devices
Send and receive one byte at a time
Classic example: the keyboard
Block Devices
Send and receive a multi-byte block at a time
Classic example: the hard disk:
Traditional Two-Fold Classification of Processor Support for I/O
Isolated I/O
Memory-Mapped I/O
Isolated I/O
The processor provides:
Dedicated physical pins for the connection of I/O devices, and
And dedicated instructions for doing I/O operations
Suited to simple devices
Having only a fixed set of special I/O instructions does not help much with device diversity
Example Intel x86 instructions
IN destination_register, port_address
OUT source_register, port_address
Port addresses are typically 8 bits: narrower than main memory addresses
Memory-Mapped I/O
Here, devices sit within the CPU’s linear memory address space
E.g. we might access the next keyboard character by reading from memory address 0x40000040
Simple, flexible programming model
Downside is that it adds complexity to devices
They need to understand larger addresses and to work at memory speeds