09 - IO Subsystem Flashcards

1
Q

State three classes of IO devices

A

Very wide range of devices that interact with the computer via input/output (IO):

(1) Human readable: graphical displays, keyboard, mouse, printers
(2) Machine readable: disks,tapes, CD, sensors
(3) Communications: modems, network interfaces,radios

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Differences between IO devices

A

(1) Data rate : keyboard vs network
(2) Control complexity : printer vs disk
(3) Transfer unit and direction : blocks vs characters vs frame stores (???)
(4) Data representation (???)
(5) Error handling (???)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is the IO subsystem the “messiest” part of the OS.

A

(1) Variety of devices / applications
(2) Dimensions of variation
=> Character-stream or block
=> Sequential or random-access
=> Synchronous or asynchronous
=> Shareable or dedicated
=> Speed of operation
=> Read-write,read-only, or write-only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why does OS need device classes.

A

5 or 6 dimensions of variation between IO devices : character stream or block …

Thus, completely homogenising device API is not possible so OS generally splits
devices into four classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

State the four types of device classes

A
  1. Block devices
  2. Character devices
  3. Network devices
  4. Misc devices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Examples : block devices

A
  • disk drives, CD
  • Commands : read, write, seek
  • Access either
    a (raw),
    b via filesystem (“cooked”),
    c or memory mapped.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Examples : character devices

A

e. g. keyboards, mice, serial
- Commands: get, put
- Layer libraries on top for line editing etc…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Examples : network devices

A
  • Vary enough from block & character devices to get their own interface.
  • Unix, Windows NT use Berkeley Socket interface… API for internet sockets, Unix domain sockets, used for IPC.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Examples : misc devices

A
  • Current time, elapsed time, timers clocks.

UNIX : ioctl system call covers other odd aspects of IO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Examples of virtual devices

A
Terminal => terminal stream
Frame buffer => window 
Raw mouse => event stream
Disk block => files 
Parallel port => print spooler 
Raw ethernet frames => transport protocols
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain how the OS creates an interface between user programs and raw hardware

A

??????????? 7 out of 20 §9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe how polled mode IO works

A

Consider simple device with three registers : status, data, command (diagram).
HOST can read / write these registers via bus.
Polled mode operation :
1. H repeatedly reads device_busy until clear
2. H sets e.g. (write) bit in command register, puts data into data register.
3. H sets command-ready and sets device_busy.
4. D performs write operation (slow)
5. D clears command_ready and then clears device_busy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Problem with polled mode IO

A

?????

- Time wasted while D is writing the data / performing its IO operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Purpose of interrupt driven IO

A
  • CPU speed&raquo_space;» IO device speed

- CPU provides interrupt mechanism to handle mismatch between CPU and device speeds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Describe : interrupt driven IO

A
  1. End of each instruction => CPU check interrupt lines for pending interrupt.
    => Need not precisely occur at definite point in instruction stream.
  2. If line asserted, CPU:
    2a Save PC, processor state.
    2b Change processor mode => kernel mode
    2c Index interrupt vector => jump to service routine.

3 Finish interrupt handling => use rti instruction to resume.

  1. More complex CPUs :
    - Multiple priority levels of interrupt
    - hardware vectoring of interrupt
    - mode dependent registers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Handling interrupt

A

???????????????????????????? slide 11

17
Q

Explain BLOCKING IO system calls

A

BLOCKING :

  • Process suspended until IO completed.
  • Easy to use and understand
  • Insufficient for some needs (???? what ???)
18
Q

Explain NONBLOCKING IO

A
  • IO call returns as much as available. (??)
  • Returns almost immediately with count of bytes read or written (possibly 0)
  • Can be used by e.g. user interface code.
  • Essentially application level “polled IO”.
19
Q

Explain ASYNCHRONOUS IO

A
  • Process runs concurrently as IO executes.
  • IO subsystem explicitly signals to the process when its IO request is complete.
  • Most flexible (and potentially efficient … why)
  • Also most complex to use (why ….)
20
Q

Why is IO buffering needed

A
  1. Cope with impedance mismatches between devices (speed, transfer size)
  2. OS may buffer data in memory.
21
Q

Buffering strategies

A
  • Single buffering : OS assigns a system buffer to the user request
  • Double buffering : process consumes from one buffer, while system fills the next.
  • Circular buffering : most useful for IO which occurs in bursts.
22
Q

Explain single buffering

A
  • OS assigns single buffer to user request ,
  • OS performs transfer, moves buffer to user space when complete (remap or copy ????)
  • Request new buffer for more IO, then reschedule app to consume (READAHEAD or ANTICIPATED INPUT ???)
  • OS must track buffers
  • Also affects swap logic - if IO is to same disk as swap device : doesn’t make sense to swap process out as it will be behind the now queued IO request ???
23
Q

Make comparison between no buffering and single buffering

A
  • t := time to input block,
  • c : computation time between blocks
  • With single buffering, time (what time ???) is max(c, t) + m, where m is the time to move data from buffer to user memory.
  • Without buffering, execution time between blocks is t + c.
    ????
  • For a terminal: is the buffer a line or a char, depends on user response required.
24
Q

Double buffering

A
  • e.g. used in video rendering
  • Rough performance comparison : takes max(c, t) .: possible to keep device at full speed if c < t, but if c > t process will not have to wait for IO. ???
  • Prevents need to suspend user process between IO operations
    … also explains why two buffers is better than one buffer, twice as big.
  • Need to manage buffers and processes to ensure process doesn’t start consuming from an only partially filled buffer.
25
Q

Circular buffering

A
  1. Allow consumption from buffer at fixed rate, potentially lower than burst rate of arriving data
  2. Typically use circular linked list = FIFO buffer with queue length ???
26
Q

BURST RATE ???

A

???