11 Flashcards

1
Q

How does an I/O device communicate with the CPU?

A

Through hardware registers available in a device controller

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

What are the five hardware registers in a device controller and what are their functions?

A

Opcode registers: hold code of operation to be performed, e.g., read or write

Operand registers: hold parameters associated with the operation, e.g., addresses to be red or written at, DMA parameters, etc.

Busy AND Status registers: provide information about availability, readiness, errors

Data Buffer registers: hold bytes transferred to or from the I/O device, e.g., value typed in on the keyboard, or text to be printed

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

What is Method 1 for accessing the device controller?

What is an advantage of Method 1 (special I/O instructions)?

What is a disadvantage of Method 1 (special I/O instructions)?

A

The CPU instruction set is extended with special I/O instructions like io_store and io_load.

It avoids interference with virtual memory since no physical address is associated with registers.

Devices cannot be mapped in user space, so users cannot directly access the device as a normal data structure.

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

What is Method 2 for accessing the device controller?

What is an advantage of Method 2 (physical address space extension)?

What is a disadvantage of Method 2 (physical address space extension)?

A

Physical address space is extended to directly refer to device registers, giving each register a physical address.

The device can be mapped to the user space, allowing easier interaction via virtual addresses.

It complicates virtual memory management, increasing system complexity.

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

What is the issue with different I/O device controllers?

Why is the lack of uniformity among I/O controllers a problem?

A

Each device may have a different set of registers, opcodes, and operands, requiring specific code for each controller.

It limits portability, increases work, and raises the risk of bugs when changing device types or brands.

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

What is the I/O subsystem in an operating system?

What are the main goals of the I/O subsystem?

How does the I/O subsystem optimize performance?

A

It is the part of the OS that manages input and output devices

Presenting a logical/abstract view of I/O devices.
Facilitating the sharing of devices.
Providing efficiency and optimizing performance.

Ensures the CPU and multiple I/O devices run in parallel.
Reorders I/O requests to improve throughput.
Uses buffering to hide latency.

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

What are some design concerns for the I/O subsystem?

A

Large variety of I/O device types (e.g., keyboards, displays, printers, etc.).
Different speeds and brand-specific approaches for devices.
Supporting the addition of new devices after OS development and installation.

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

What are the two levels of abstraction in I/O systems?

A

High-level I/O abstraction
Low-level I/O abstraction

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

What is the focus of high-level I/O abstraction?

Give examples of tasks handled by high-level I/O abstraction.

A

Provides generic code for handling classes or families of I/O devices.

High-level operations to read or write data on disk or CD-ROM.
Implementation of network protocols, such as TCP.

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

What is the role of low-level I/O abstraction?

How does low-level I/O abstraction interact with devices?

A

Encapsulates brand-specific device issues with well-defined low-level operations (e.g., read, write, open, close).

A device driver implements low-level operations for each specific device.

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

What is the role of device drivers in low-level I/O abstraction?

Are device drivers software or hardware?

A

Device drivers implement the specific operations needed for each hardware device.

Software programs

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

What are three classes of I/O Devices?

A

Block-oriented/Storage Devices

Stream-oritented Devices

Network Communication Devices

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

What are the primary uses of block-oriented I/O devices?

Examples

A

Reading and writing blocks of data in arbitrary order

hard drive, ssd, CD reader, magnetic tape

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

What are primary uses of stream-oriented I/O Devices?

Examples

A

input and output data in a SEQUENTIAL way

keyboards, sensors, actuators, mouses

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

What are the primary uses of network communication devices?

A

Sending and receiving packets on a network socket interface

providing connection and communication protocols

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

What to do if I/O devices do not fit any class? Two options

A
  1. Let user application directly access driver
  2. Extend capabilities of OS with new APIs via external libraries
17
Q

What does the device driver implement?

Examples

A

A collection of standard operations and functions

read, write, open, close, seek, select

18
Q

In what three ways does the device driver communicate with the device controller?

A

Polling

Interrupts

DMA

19
Q

How does the device controller communicate with the driver through polling?

Main downside?

A

Driver initiates I/O operations in the device controller and observes completion (I.e., busy waits) or periodically wakes-up to check completion.
I.e., driver polls device controller repeatedly and tests.

WASTING CPU TIME

20
Q

How does the device controller communicate with the driver through interrupts?

A

Driver initiates I/O operations in the device controller and then yields the CPU

Device controller uses interrupts to inform the CPU about readiness, errors, operation completion

21
Q

How does the device controller communicate with the driver through DMA?

Main benefit?

A

After initialisation, DMA independently moves groups of data between device controller and memory.

Less overheads for CPU, only one interrupt handling when whole transfer is completed instead of one per message

22
Q

What is I/O buffering?

What are four problems that it solves?

A

technique used in computer systems to temporarily store data being transferred between the CPU and input/output (I/O) devices

  1. Speed/latency mismatch: process must wait for relatively slow I/O to complete before it can send new data to write on disk
  2. Data granularity mismatch: application may expect to receive data in smaller pieces than a block
  3. Conflict with the swapping decisions made by the OS: pages containing virtual address range must remain in physical memory until I/O completes or driver/DMA may write the data and the wrong physical address or corrupt the address of another process
  4. Improving efficiency: can perform input transfers before requests through predictions, delay outputs on ppurpose when necessary, and cache data
23
Q

What is a buffer?

A

A dedicated kernel memory space or set of hardware registers that holds data of a producer until its consumer is ready to consume

24
Q

Distinguish between the buffering of inputs and that of outputs

A

For inputs:
Data is written into buffer first, then moved to user process address space.

For outputs:
Data is moved to the buffer first, then data is output directly from the buffer.

25
Q

What is single buffering? What type of transfer does it enable?

A

Refers to the use of a singular buffer.

Asynchronous transfer, where the input device can produce data without waiting for the process to be ready to consume it, and vice versa.

26
Q

What is double buffering?

What does it reduce?

A

The use of two distinct, independent buffers

Idle time, as the OS can move the content of one buffer from kernel to user space, while the device controller is filling the other buffer

27
Q

What is circle buffering?

How does it work?

A

Technique used to manage data in a buffer organized as a ring (circular) structure, where the end of the buffer wraps around to the beginning

Buffer has fixed size and two pointers (head and tail).
New data is written to location pointed to by head pointer.
Data is read from location pointed to by tail pointer.
Once data is read, tail pointer advances to next slot.
When head pointer reaches the end of buffer, it wraps back to the beginning.

28
Q

How can buffering performance be evaluated?

What does T represent?

M?

C?

D?

What is the formula for throughput?

A

By computing the throughput

time to transfer data from the I/O device to the operating system’s buffer

Time to move the data from the OS buffer to the user process’s memory space

Time the process need to operate on one data (computation time)

Minimum time until next data may become available in user space

1/D

29
Q

What is D in the case of no buffer? Why?

A

D=T+C since the data needs to be transported from the I/O device to the main memory, with no buffer, and computation time must be accounted for.

30
Q

What is D in case of a single buffer?

A

D = max(C,T) + M since C and T can happen in parallel. I.e., the computation on the data can be carried out WHILE it is being moved

31
Q

What is D in case of a double buffer?

A

D = max(M+C, T) because the move cannot start before the computation completes, but the move and computation happen in parallel to the data transfer

32
Q

What is a hard-drive’s structure divided into?

A

Several platters, or disks

These are further divided in tracks which are circular regions of the disk, from inwards to outwards

Then, the tracks are divided in sectors, which are portions of the tracks

33
Q

What is a cylinder?

A

Set of tracks that are at the same arm positions

34
Q

What is the average time to read/write one block on the disk T_read?

What is r?

What is B?

What is N

A

bytes per track

T_read = T_seekcylinder + T_movetosector + T_readblock
= t_seekcylinder + 1/2r + B/rN

rotations per second

35
Q

How is disk schedulnig carried out?

A

Buffering requests for blocks.

Block requests are treated according to a scheduling policy