ECM 1413 I/O devices Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What does an I/O device do?

A

I/O devices enable computers to receive or output information to humans or devices.

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

Types of I/O devices (+ examples for each)

A

human interface devices, such as screens or keyboards
storage devices, such as disks
transmission devices, such as network cards

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

What is communication between I/O devices performed over?

A

Buses

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

What does a controller do in the context of I/O devices?

A

The I/O devices are operated using controllers (embedded processors)

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

The processor communicates with the controller by reading and writing to the controller’s registers.

What are the registers in question?

A

data-in register — data coming from device
data-out register — data going to device
status register — indicating status of device
control register — commands to device

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

How can controller registers be accessed?

A

special instructions (port-based I/O):
the CPU uses special I/O instructions for transferring a small number of bytes to an I/O bus address

standard memory instructions (memory-mapped I/O):
the CPU treats the device “as memory”; control registers are mapped to specific memory addresses

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

Differences between Port-mapped I/O (PMIO) and Memory-mapped I/O (MMIO)

A

PMIO uses a separate IO address space; this is treated as part of memory space in MMIO.

MMIO only requires standard memory instructions to access registers as they are a part of main memory; PMIO needs special instructions to access the IO address space.

MMIO is more common than PMIO

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

The 2 approaches to controlling IO devices

A

1 polling
2 interrupts

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

Polling

A

The CPU repeatedly checks the controller’s status register to see whether the controller is busy
When the controller is ready and the CPU wants to give new instructions, the CPU writes to the data-out register and signals that is has done so through the control register

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

Interrupts

A

Interrupts The CPU regularly senses an interrupt-request line
When the CPU gets an interrupt signal through the interrupt-request line, it stops the current process and initiates a response

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

Differences between polling and interrupts

A

Interrupts can monitor the status of several devices at the same time, and serve them based on priority
Polling needs to check each device individually in a round-robin fashion
Interrupts are much more commonly used since this frees the CPU from polling devices that do not need service

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

Polling may be efficient if

A

the controller and the device are fast
the I/O rate is high
some I/O data can be ignored
the CPU has nothing better to do

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

Large Data Transfers

A

Some devices (e.g., disk drives) will often do large data transfers
The transfer will be inefficient if the CPU has to feed data, byte by byte, to the controller’s registers
A better approach is to offload this work to a special-purpose processor (a direct memory access (DMA) controller)

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

How does Direct Memory Access work

A

The CPU writes a command block into memory, specifying the source and destination of the transfer
The DMA controller can then perform multiple transfers via a single command
When the transfer is complete, the CPU receives an interrupt from the DMA controller
This enables the CPU to spend more resources on other tasks

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

What does a device driver do

A

A device driver hides differences between various device controllers by defining an interface between the OS and I/O devices for a specific class of I/O devices.

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

Instructions are executed either in user mode (application programs; plain instructions) or kernel mode (system functions; privileged instructions).

A system call is a request of a kernel service.

system calls for

A

1 character I/O
2 block I/O
3 network I/O

17
Q

character I/O

A

Examples: keyboards, computer mice, microphones, speakers

A character device transfers bytes one by one

Characters must be processed in order that they arrive in the stream

The interface includes get operation, to return the next character in the stream put operation, to add character to stream libraries for line-by-line access, with integrated editing services (e.g., use backspace to remove the preceding character from the stream)

18
Q

block I/O

A

Block devices (typically non-volatile mass storage devices) are used to transfer blocks of data

The interface includes read operation, for reading blocks of data write operation, for writing blocks of data block devices are high volume devices

19
Q

network I/O

A

A network socket interface has system calls for:

creating and connecting sockets

sending and receiving packets over the connection

select function, for determining the status of one or more sockets (whether the socket is ready for reading or writing)

The main difference between network I/O devices and other I/O devices is that with network I/O devices things routinely go wrong (missing packets, etc.)

Therefore, there need to be system functions for checking whether a transfer was successful recovering gracefully from unsuccessful transfers