Professional Documents
Culture Documents
Input / Output
http://it.yorku.ca
ITEC 1011
ITEC 1011
I/O Configurations (1 of 2)
CPU
Keyboard Mouse Voice input (microphone) Scanner Voice output (speaker) Dot-matrix printer Laser printer Graphics display Local area network Optical disk Magnetic tape Magnetic disk
ITEC 1011
I/O Configurations (2 of 2)
I/O data I/O address I/O control I/O module I/O module I/O device CPU
ITEC 1011
I/O device
I/O device
I/O device
I/O device
A Previous Question
How is I/O differentiated from memory? Two possibilities
Memory-mapped I/O I/O-mapped I/O
ITEC 1011
Memory-Mapped I/O
Memory and I/O
reside in the same space are accessed in the same manner
Memory Map
FFFF
I/O
Memory
0000
ITEC 1011
A Previous Question
How is I/O differentiated from memory? Two possibilities
Memory-mapped I/O I/O-mapped I/O
ITEC 1011
I/O-Mapped I/O
Memory and I/O
Occupy different spaces Are accessed by unique instructions
Memory Maps
FFFF FFFF
Memory
I/O
0000
ITEC 1011
0000
Introduction to Information Technologies
ITEC 1011
M/IO
Datadata I/O bus Address bus I/O address Control bus I/O control I/O module Memory I/O device CPU
ITEC 1011 One of the control bus signals is named M/IO Introduction to Information Technologies
Types of I/O
Programmed I/O Interrupt-driven I/O Direct memory access (DMA)
ITEC 1011
Programmed I/O
I/O operations are under direct control of software (program) Software initiates the I/O operation Disadvantage:
Slow Uses a lot of CPU resources
Advantage:
Simple
p. 209 ITEC 1011 Introduction to Information Technologies
Polling
A form of programmed I/O, wherein device status is checked to determine if an I/O operation is needed E.g.,
A keyboard can be polled to determine if a key has been struck and a code is waiting to be read
Useful when there are a lot of similar devices connected to one system (e.g., hundreds of terminals)
ITEC 1011
Status registers
To check the status of a device
ITEC 1011
Types of I/O
Programmed I/O Interrupt-driven I/O Direct memory access (DMA)
ITEC 1011
Interrupt-driven I/O
I/O operations are initiated by the device The device, or its I/O module, includes a signal to interrupt the CPU These signals are called interrupt lines A typical CPU supports 8 to 16 interrupt inputs Typical names: IRQ1, IRQ2, IRQ3, etc.
p. 211 ITEC 1011 Introduction to Information Technologies
Servicing an Interrupt
When an interrupt occurs (and is accepted), the execution of the current program is suspended A special routine executes to service the interrupt Then, the interrupted program resumes The service routine is called an interrupt handler or interrupt service routine (ISR)
ITEC 1011
Saving Registers
For the interrupted program to resume, the CPU status and data registers must be saved (because they will change during the ISR) They are saved before the ISR executes They are restored after the ISR executes They are saved either
On the stack (a special area of memory to temporarily hold information), or In a process control block (PCB)
ITEC 1011
Use of Interrupts
As an external event notifier As a completion signal As a means of allocating CPU time As an abnormal event indicator
ITEC 1011
Use of Interrupts
As an external event notifier As a completion signal As a means of allocating CPU time As an abnormal event indicator
ITEC 1011
Use of Interrupts
As an external event notifier As a completion signal As a means of allocating CPU time As an abnormal event indicator
ITEC 1011
Use of Interrupts
As an external event notifier As a completion signal As a means of allocating CPU time As an abnormal event indicator
ITEC 1011
Types of I/O
Programmed I/O Interrupt-driven I/O Direct memory access (DMA)
ITEC 1011
Why DMA?
Used for high-speed block transfers between a device and memory During the transfer, the CPU is not involved Typical DMA devices:
Disk drives, tape drives
p. 223
How
The CPU prepares the DMA operation by transferring information to a DMA controller (DMAC):
Location of the data on the device Location of the data in memory Size of the block to transfer Direction of the transfer Mode of transfer (burst, cycle steal)
When the device is ready to transfer data, the DMAC takes control of the system buses (next few slides)
ITEC 1011 Introduction to Information Technologies
Taking Control (1 of 2)
CPU
Control Bus signals
DMAC
BR BG BGACK
BR BG BGACK
BR BG
= Bus request (DMAC: May I take control of the system buses?) = Bus grant (CPU: Yes, here you go.)
ITEC 1011
Taking Control (2 of 2)
DMAC issues a BR (bus request) signal CPU halts (perhaps in the middle of an instruction!) and issues a BG (bus grant) signal DMAC issues BGACK (bus grant acknowledge) and releases BR DMAC has control of the system buses DMAC acts like the CPU and generates the bus signals (e.g., address, control) for one transfer to take place Then
ITEC 1011 Introduction to Information Technologies
DMA Transfers (2 of 2)
Burst mode
This transfer is repeated until complete DMAC relinquishes control of the system buses by releasing BGACK
BR-BG-BGACK Timing
time
BR BG BGACK
DMA cycles
CPU cycles
time
time Legend: CPU cycle DMA cycle BR/BG/BGACK sequence ITEC 1011 Introduction to Information Technologies
Types of I/O
Programmed I/O Interrupt-driven I/O Direct memory access (DMA)
ITEC 1011
ITEC 1011
DMA
Data bus Address bus Control bus CPU DMAC Memory Disk The transfer takes place
ITEC 1011
IRQ
ITEC 1011
ITEC 1011
Bus Architecture
Used in (pretty well all) PCs, workstations, and some mainframe computers We have already met the data, address, and control buses that connect a CPU to memory and I/O modules Collectively, these are the CPU busor system bus Between the I/O modules and I/O devices, an I/O bus is required A bus interface connects one bus to another Lets have another look p. 228
ITEC 1011 Introduction to Information Technologies
CPU-Memory-I/O Architecture
Memory
CPU
I/O module
I/O device
Bus interface
I/O bus
ITEC 1011
Channel Architecture
An alternative I/O architecture Used by IBM in their 370/XA and ESA/370 mainframe computers I/O occurs through an I/O processor the channel subsystem
Frees the CPU for other tasks Has its own instruction set channel control words Channel control words stored as programs, just like other CPU instructions Channel programs transfer data between I/O devices and memory via DMA
p. 236 ITEC 1011 Introduction to Information Technologies
CPU
Memory
Channel subsystem
Channel paths
Control unit
Control unit
Control unit
Device
ITEC 1011
Device
Device
Device
Thank you
ITEC 1011