Lecture 11 - Devices Flashcards

1
Q

What is the difference between memory-mapped i/o and port-mapped i/o?

A

Memory mapped: mapped into memory and accessed using memory functions

Port-mapped: dedicated address space accessed using specialised processor instructions

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

How is I/O polling done?

A

CPU starts I/O then busy-waits for completion

Device has registers

For output, cpu writes data into data register, starts device write, busy-waits until status register indicates write is done

For input, cpu starts device reading, busy-waits until status register indicates read is done, then reads data in data register

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

How does Interrupt based I/O work?

A

CPU starts i/o device writing or reading

I/O device finishes writing/reading and sends interrupt to CPU

CPU jumps to correct handler which runs, then moves back to where it was when the interrupt occurred.

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

How does direct memory access I/O work?

A

Bypasses CPU to transfer data directly between I/O device and memory

Used to simplify/speed up large data movement

Makes CPU pause

REQUIRES DMA CONTROLLER

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

How do I/O channels work?

A

Device has specialised processor

CPU asks device to execute entire I/O program

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

What do device drivers do?

A

Go between device controllers and rest of OS

Communicate with controllers over bus

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

What do device controllers do?

A

Communicate with devices and, erm, control them

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

What is device independent I/O software?

A

Provides common library routines for things

e.g. buffering, error reporting, allocating and releasing dedicated devices

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

What sort of things might a device driver do?

A

Initialise devices

Interpret commands from OS

Manage data transfers

Accept and process interrupts

Report errors

e.g. init(), open(), close()

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

What is a block device?

A

Disk, cd-rom, tape..

transfers data in blocks of fixed or variable size

Usually used to store data, e.g. filesystem

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

What is a character device?

A

terminal, printer, keyboard, mice..

Transfer data a byte at a time

don’t store data

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

What is an example interface for a character device?

A

read(devicenumber, buffer, size)

write(devicenumber, buffer, size)

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

Example interface for block device

A

read(device, fromaddr, buffer)

write(device, toaddr, buffer)

seek(device, addr)

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

How does UNIX identify a device?

A

Major number - identifies device type

minor number - instance of a device type

e.g.

8,2 means:

8 - scsi disk driver

2 - a specific scsi disk

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

how does UNIX treat devices wrt the filesystem

A

Treats them as files so they show up under the filesystem with no content but metadata associated with it

located in /dev

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

Why use a i/o buffer?

A

alleviate effects of mismatch between producer and consumer, i.e. transfer speed & size of transfer

Spooling - avoid deadlock

Caching - help with repeated requests for same data

17
Q

What is the difference between synchronous and asynchronous I/O?

A

Sync: read() or write() will block user process until completion. OS overlaps this with another process execution

Async: read() or write() will not block process

Lets user process do other things before completion

I/O completion notifies user process