I/O Management Flashcards

1
Q

What are an I/O device’s control registers?

A

Use to communicate with OS. Three types: command (send commands to device), data (send data), status (status of device).

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

Describe the I/O device stack

A
Hardware 
Controller (incl. with device)  
Driver 
kernel I/O Subsystem  
Kernel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What s a device driver?

A

A piece of software that is responsible for accessing, managing, and controlling a device. Each OS has an interface that each device must implement.

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

What are the types of I/O devices?

A
  1. Block (e.g. disk) - read blocks of data
  2. Character (keyboard) - get/put a char
  3. Network - stream data chunks of different sizes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name some virtual devices

A

/dev/null, /dev/random

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

How does an OS represent a device?

A

A file, can use file abstractions to write to device. Can use a special file system (tempfs, devfs)

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

Name the two types of device–>CPU interactions

A

Memory-mapped and I/O port

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

What is memory-mapped I/O?

A

Part of the OS’s physical memory is dedicated to I/O interactions and devices’ registers appear to OS as physical memory addresses. The PCI bus translates physical memory to appropriate device

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

What is BAR?

A

Base Address Registers - device registers that control how much memory the device needs mapped into the OS (in memory-mapped I/O)

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

What is I/O Port?

A

Device-CPU interaction where the CPU has special instructions to interact with the device

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

How does a device communicate back to the OS?

A

Interrupts or Polling

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

What is PIO?

A

Programmed I/O - device access method where CPU can ‘program’ the device using the command registers and passing data through data registers. Requires no additional hardware support, but is slow

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

What is DMA?

A

Device Memory Access - device access method that relies on additional hardware support, but is faster than PIO for large data transfers. CPU writes commands to command registers, but configures DMA controller to point to MM where data is located. DMA then copies data over.

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

What is an OS Bypass device access?

A

Can have user process directly access device by mapping device into user address space. Requires a user-level driver that is included while linking and the device needs to be able to support multiple processes accessing it - sufficient resources to split them + know which process to send a result back to

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

What is an inode?

A

Persistent representation of a file. A list of blocks that contain the file’s data

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

What is a dentry?

A

Directory entry, represents a directory and is not stored on disk.

17
Q

What is the dentry cache?

A

List of all the directories we traversed to get where we are now

18
Q

What is a superblock?

A

File system specific information on how the FS is laid out

19
Q

What is the limitation on inodes and how do you fix it?

A

There is a limit to the size of the file. You can fix is by using indirect pointers

20
Q

What is an inode with an indirect pointer?

A

inode contains: metadata, list of blocks, indirect pointer, double indirect pointer, etc
Indirect pointer is just another list of of blocks
Double indirect is a list to a list of blocks

21
Q

What are some ways to optimize disk I/O access?

A
  1. Caching file in main memory
  2. I/O scheduling - schedule how / when we access blocks (faster to modify blocks in order)
  3. Prefetching - if a block is accessed, it’s likely that blocks around it will be accessed soon
  4. Journaling / logging - write updates to a log on device, then periodically write changes to device