I/O (PPT 11-12) Flashcards
What does input/output allow you to do?
It allows the computer to communicate with the world outside the box:
- receive data and instructions from programs
- allow output of processed results
What does I/O usually involve?
It usually involves:
- Copying a large block of memory to another block
- Copying a large block of memory to one address a chunk at a time
- Copying from one address to a large chunk of memory one chunk at a time
Have I/O speeds increased over the years?
Yes, but barely. The I/O chip is attached to very slow things so can barely be increased
Where must data be to be read?
Data must be in main memory, so external data must be read into main memory to be used
What are four of the many areas we must account for when using I/O?
- Data rate
- Unit of Transfer
- Data representation
- Error conditions
What size is a chunk in a I/O transfer?
Each chunk is the size of the data register
What two areas must we consider when interfacing?
Output:
The CPU should only place new data in the data out register of the I/O chip when I/O is ready
Input:
The CPU should only attempt to read from the data in register when new data has been completely received
What are the three main ways of doing I/O?
- Polling
- Interrupt-Driven I/O
- Direct Memory Access
What is Polling?
Polling is when the CPU constantly checks to see if the item in use is ready. If it is, it sends/receives data. If not, it waits and checks again until the item says it is ready
What is the issue with Polling?
Polling can cause problems where multiple I/O channels are available, meaning it could miss some events while checking others
What are the advantages and disadvantages with Polling?
Adv:
- needs no hardware support
- simple, easy to implement
- easy to debug
Disadv:
- very wasteful of CPU time
- possible problems with multiple events
What is Interrupt Driven I/O?
An interrupt is a suspension of a process caused by an event outside of the process. The suspension is in such a way that the process can be resumed at a later point.
How does Interrupting work?
The CPU issues an I/O command then continues on executing other instructions. When the I/O device requires attention, it interrupts the CPU. The code for an interrupt is a special subroutine called an interrupt handler.
What is a multi-level interrupt?
This means that low priority interrupts can be interrupted themselves by higher level interrupts, such as by the disk drive
What are the advantages and disadvantages of Interrupt Driven I/O?
Adv:
- more time efficient than polling, avoids the CPU having to repeatedly loop to test the status of a register
- powerful way of handling multiple I/O devices
Disadv:
-overhead in handling interrupts, need to save an restore CPU status, this may take longer than handling the interrupt itself
-hardware needed to support interrupts
-difficult to debug an interrupt scheme
still requires the active intervention of the CPU to do the actual data transfer