Professional Documents
Culture Documents
Chapter 05 IO
Chapter 05 IO
Chapter 05 IO
Input/Output
5.1 Principles of I/O hardware
5.2 Principles of I/O software
5.3 I/O software layers
5.4 I/O devices: Disks,
Character-oriented terminals,
Clocks
1
5.1 Principles of I/O hardware
2
Principles of I/O Hardware
Types of I/O devices
3
Principles of I/O Hardware
Types of I/O devices
Some typical device, network, and data base rates
4
Principles of I/O Hardware
Common concepts
Common concepts
– I/O Device Controller
– I/O Port
– I/O Bus
5
Principles of I/O Hardware
Device Controllers
Monitor
Bus
8
Principles of I/O Hardware
A Typical PC Bus Structure
9
Principles of I/O Hardware
I/O address
10
Principles of I/O Hardware
Memory-Mapped I/O (1)
13
Principles of I/O Hardware
Programmed I/O, Polling
14
Principles of I/O Hardware
Interrupt-Driven I/O
15
Principles of I/O Hardware
Example: Interrupts of PC computer
17
Principles of I/O Hardware
Direct Memory Access (DMA)
19
5.2 Principles of I/O software
20
Principles of I/O Software
Goals of I/O Software (1)
• Device independence
– programs can access any I/O device
– without specifying device in advance
(floppy, hard drive, or CD-ROM)
• Uniform naming
– name of a file or device is a string or an integer
– not depending on which machine
• Error handling
– handle as close to the hardware as possible
21
Principles of I/O Software
Goals of I/O Software (2)
• Synchronous vs. asynchronous transfers
– blocked transfers vs. interrupt-driven
• Buffering
– data coming off a device cannot be stored in
final destination
• Sharable vs. dedicated devices
– disks are sharable
– tape drives would not be
22
Principles of I/O Software
Programmed I/O (1)
26
A Kernel I/O Structure:
Hardware And Software
27
5.3 I/O software layers
28
I/O Software Layers
29
I/O Software Layers
Interrupt Handlers (1)
• Interrupt handlers are best hidden
– have driver starting an I/O operation block until
interrupt notifies of completion
• Interrupt procedure does its task
– then unblocks driver that started it
• Steps must be performed in software after interrupt
completed
1. Save regs not already saved by interrupt hardware
2. Set up context for interrupt service procedure
30
I/O Software Layers
Interrupt Handlers (2)
3. Set up stack for interrupt service procedure
4. Ack interrupt controller, reenable interrupts
5. Copy registers from where saved to process
table
6. Run service procedure
7. Set up MMU context for process to run next
8. Load new process' registers
9. Start running the new process
31
I/O Software Layers
Device Drivers
35
I/O Software Layers
Device-Independent I/O Software (4)
Layers of the I/O system and the main functions of each layer
37
5.4 I/O devices
38
I/O devices
39
Disk Hardware (1)
40
Disk Hardware (2)
Parallel port
Memory-mapped displays
• driver writes directly into display's video RAM
43
Display Hardware (2)
44
Display Hardware (3)
45
Character Oriented Terminals
RS-232 Terminal Hardware
A programmable clock
47