I/O System (12) Flashcards
1
Q
Typical pc bus structure
A
2
Q
Type of I/O devices
A
- Storage
- transmission
- human-interaction
3
Q
I/O Port
A
Connection point
4
Q
I/O: Bus
A
- Could be daisy chain or shared direct acces
- PCI bus common in PCs and servers
- Exansion bus connects relatively slow devices
- Serial-attached SCSI: common disk interface
5
Q
I/O Controller
A
- AKA host adapter
- Sometimes it is integrated, sometimes it is in a separate circuit board
- Contains processor, microcode, private memory and bus controller
6
Q
Polling
A
For each byte of I/O:
- Read busy bit from status register until 0
- This is busy-waiting
- Ok if device is fast
- inefficient if device is slow
- Hosts sets read or write bit and copies data into data-out register if write is true
- This is busy-waiting
- Host sets command-ready bit
- controller sets busy bit, executes transfer
- controller clears busy bit, error bit, command-ready bit when transfer done
7
Q
Interrupts
A
- Interrupts are a better choice if the busy bit is often 1;
- CPU interrupt-request line triggered by I/O device (processor checks it every epoch)
- Interrupt handler: handles it
- Can be masked
- Interrupt vector:
- to call the right interrupt handler
- some handlers are not maskable
- can be prioritized
- Interrupt chaining if more than one device at same interrupt number
- Used also for exceptions
- Page fault when memory access error
- Terminate process, crash system due to hw error
- Multi-cpu sys. can handle interrupt concurrently
8
Q
DMA
A
- Direct Memory Access
- Used to avoid programmed I/O (one word at a time) for large data movement
- Requires DMA controller
- Bypasses to CPU to transfer data directly between I/O and memory
- OS writes DMA command into memory block
- source and dest location
- read/write mode
- bytes count
- writes location of command block to DMA controller
- Steals cycles (uses bus) from CPU, but still more efficient
- Interrupt on completion
- DVMA: aware of virtual addresses.
9
Q
Application I/O interface
A
- Abstract interface
- Device layer hides differences among I/O controller from kernel
- I/O sys calls encapsule device behaviours in different classes
- Behaviours
- Character stream vs. block
- sequential vs random access
- Sync vs Async vs both
- Sharable vs dedicated
- speed of operation
- read-write vs read only vs write only
- Behaviours
- Each OS has its own I/O subsystem that handles this stuff
10
Q
I/O devices distinctive traits
A
- Device driver handle in a different way devices based on the traits
- Usually can be grouped by OS into:
- block i/o
- character i/o (stream)
- memory-mapped file access
- network sockets
- Usually there is a way to have raw access
- UNIX: ioctl() -> sends arbitrary bits to device control register
*
- UNIX: ioctl() -> sends arbitrary bits to device control register
11
Q
Block and character devices
A
- Block devs:
- disk drives
- commands
- read
- write
- seek
- raw i/o, direct i/o, filesystem access
- memory-mapped file possible
- DMA
- Character devs:
- keyboard, mouse, serial ports
- commands
- put
- get
12
Q
Network devices
A
- Can vary:
- block
- character (stream)
- Linux, Unix, Windows include socket interface
- separates network protocol from network op.
- many different approaches
- pipes
- fifo
- streams
- queues
13
Q
Clocks and timers
A
- Used to get time, elapsed time, timer
- Used to generate recurring waveforms
- ioctl() covers aspects of these
14
Q
Nonblocking and async I/O
A
- Blocking: process suspended until I/O completed
- Nonblocking: I/O returns as much as it is available
- UI, data copy
- done via multithreading
- returns quickly with count of bytes read or written
- Async: process runs while I/O executes
- Difficult to use
- I/O subsystem signals completion
15
Q
Vectored I/O
A
- Allows one system call to do I/O in parallel on multiple devices
- Example: readve
- accepts a vector of multiple buffers to read/write from/to
- Better than individuals calls
- decreases context switching
- some versions provide atomiciy
- preventing threads to change data while read/writes are being performed