P3L5: I/O Management Flashcards

1
Q

What are the steps in sending/receiving a command to/from a device?

A
  • The user makes a system call when they need to access a device, which goes to the kernel.
  • The kernel runs the stack associated with the device (and maybe formats the request for the device driver).
  • The kernel invokes the correct driver, which configures the request for the device.
  • The device driver issues commands and sends data via either Programming I/O (PIO) or Direct Memory Access (DMA) operations.
  • The driver ensures data is delivered and is not overwritten

For the reverse, everything happens backwards.

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

What is OS-bypass?

A

In OS-bypass, devices are accessed directly by user processes. This requires a user-level driver (a library).

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

What are the two different routes we can take from device to CPU? What are their pros and cons?

A

1) Devices can generate interrupts to the CPU.

The downside is the interrupt handlers, which cost CPU cycles. There may be setting/resetting of interrupt masks as well as more indirect effects due to cache pollution. That being said, interrupts can be triggered by the device as soon as the device has information for the CPU.

2) CPUs can poll devices by reading their status registers to determine if they have some response/data for the CPU.

For polling, the OS has the opportunity to choose when it will poll. The OS can choose to poll at times when cache pollution will be at its lowest. However, this strategy can introduce delay in how the event is observed or handled, since the handling happens at some point after the event has been generated by the device. In addition, too much polling may introduce CPU overhead that may not be affordable.

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

Describe programming I/O (PIO)

A

In PIO, the CPU writes directly to device registers. Registers are small, though, so sending large amounts of data requires repeated CPU writes and acknowledgements on the part of the device.

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

Describe direct memory access (DMA)

A

DMA is only possible with additional hardware (DMA controller). With DMA, the CPU creates a buffer in DRAM that the device can access directly without the CPU intermediating.

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

What does the virtual file system (VFS) do?

A

The virtual file system abstracts away the details of underlying file systems, allowing user processes to interact with a variety of file systems (both local and remote) as if they were all one.

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

What are the elements of the VFS stack?

A
  • File
  • Inode
  • Directories
  • dentry and deentry cache
  • superblock
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a file?

A

The VFS supports a file abstraction: this is what user processes interact with and the element that the VFS operates on. It’s a logical storage unit that maps to a physical storage location. The OS represents files with file descriptors (integers), which are created when a file is opened.

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

What is an inode?

A

For each file, the VFS maintains an inode. The inode is a persistent data structure that maintains information about a file, including a list of all data blocks (pointers to data blocks) that correspond to the file, permissions, file size, whether the file is locked, etc. The inode is necessary because a file’s data blocks may be scattered all over the storage medium.

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

What is the problem related to inode size and how do we get around it?

A

The size of the inode can limit the potential size of a file. A 128b inode with 4b pointers address 1kb blocks can have at most 32 data block, so 32kb file. To expand possible file size, we use indirect pointers, which point to blocks of pointers (which themselves can point to more blocks of pointers, or point directly to data blocks).

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

What are VFS directories, dentries, and dentry caches?

A

The OS system maintains directories, which are like files but with information about files and their inodes, and a dentry (directory entry) for each component of a path (/, /user, and /user/myname separately) that is traversed while getting to a file. These components are held in the dentry cache, which in other words contains info on previously visited directories. This can be used later when searching for other files. dentry objects exist only in memory, they are not persistent. It maintains a map the filesystem uses to find inodes and data blocks.

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

What is is a superblock?

A

The superblock abstractions maintains info about how a filesystem is laid out on a storage device. The superblock works like a map, helping the filesystem find inodes and data blocks.

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

What are four optimizations that can reduce the overheads associated with accessing the physical device?

A
  1. Caching
  2. I/O scheduling
  3. Prefetching
  4. Journaling/Logging
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is caching (with respect to filesystems)?

A

Filesystems can cache blocks in main memory to reduce the number of disk accesses

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

What is I/O scheduling?

A

One of the largest overheads is moving the disk head, so filesystems benefit from smart scheduling of IO requests to reduce disk head movement. It maximizes sequential vs random access.

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

What is prefetching?

A

There is a lot of locality to which blocks are needed. If block 16 is requested, we likely will need 15 and 17 soon, too. So we fetch all three. This increases cache hits.

17
Q

What is journaling/logging?

A

This addresses the possibility of system crashes. In the event of a crash, files could be left in an invalid, partially written state. In journaling, we record the changes we’re going to make (by recording block, offset, value, etc.), then periodically perform the writes that are stored in the journal. Then if a crash happens, we can just go through the recorded changes in the journal until the system is consistent again.

18
Q

What is cache pollution?

A

Cache pollution is when a process loads data into CPU cache unnecessarily, thus causing other useful data to be evicted into lower levels of the memory hierarchy, degrading performance.

19
Q

What is an interrupt mask?

A

A CPU feature that allows the computer to ignore (mask) an interrupt request until the mask bit is disabled.