P3L5. I/O Management Flashcards

1
Q

What is an I/O device? Examples?

A

A device specifically responsible for providing inputs or directing outputs.

Keyboard

Display

Microphone

Speakers

Mouse

Network Interface Card Disk

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

What are basic I/O device features?

A

Control registers

Can be accessed by the CPU and permit CPU/device interactions. Divided into:

  • command registers: used by the CPU to control what the device will do
  • data registers: used by the CPU to control data transfers in/out of the device
  • status registers: used by the CPU to find out what’s happening on the device

Microcontroller

The device’s CPU

On Device Memory

Other Logic

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

What’s a device driver?

A

A device-specific software component. The OS has to include a device driver for every device type in the system.

Device drivers are responsible for access, management, and control.

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

What are the types of devices? What do they do?

A

Block: disk

  • read/write blocks of data
  • direct access to arbitrary block

Character: keyboard

  • get/put character

Network devices

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

How does the OS represent a device?

A

As a special device file.

In Unix-like systems all devices appear as files under /dev in a special file system (e.g., tmpfs, devfs)

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

What is memory-mapped I/O?

A

Device registers appear to the CPU as memory locations at a specific physical address.

When the CPU writes to these locations, the integrated memory PCI controller routes the write to the correct device.

This means that a portion of physical memory is dedicated for interactions with the device.

The portion of memory reserved for I/O interactions is controlled by Base Address Registers (BAR)

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

What is I/O port?

A
  • dedicated in/out instructions for device access
  • target device (I/O port) and value in register
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can the CPU learn of a device’s status?

A

Interrupt: device can generate interrupts to the CPU

  • interrupt handling steps

+ can be generated as soon as possible

Polling: CPU can poll device by reading its status register

+ when convenient for OS

  • delay or CPU overhead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Programmed I/O (PIO) vs Direct Memory Access (DMA)?

A

A system can request an operation from a device using programmed I/O or Direct Memory Access (DMA)

Programmed I/O (PIO)

  • no additional hardware support
  • CPU “programs” the device via command registers and data registers
  • requires many store instructions by CPU
  • better for small transfers

Direct Memory Access (DMA)

  • relies on special hardware support: DMA controller
  • CPU “programs” the device via command registers and DMA controls
  • requires 1 store operation by CPU
  • data buffer must be in physical memory until transfer completes. thus, memory regions involved in the transfer are pinned (non-swappable)
  • better for large transfers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is OS bypass?

A

Access to a device doesn’t have to go through the kernel. This is called OS bypass.

  • device registers/data directly accessible
  • OS configured, then gets out of the way
  • requires “user-level driver”
  • OS retains coarse-grain control
  • OS relies on device features
    • sufficient registers so some can be devoted to the user process but some can still remain for the kernel for course-grain control
    • demux capability to correctly pass data arriving at the device to the correct process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens to a calling thread when an I/O request is made?

A

Synchronous I/O operations

  • process blocks

Asynchronous I/O operations

  • process continues

Later…

  • process checks and retreives results
  • OR the process is notified the operation completed and results are ready
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the block device stack?

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

What is a virtual file system?

A

A virtual file system layer hides from applications all details about the underlying file system.

Applications interact with the virtual file system using the same API (e.g., POSIX API). The virtual file system specifies a more details API that each of the underlying file system must implement.

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

What a some virtual file system abstractions?

A

file: elements on which the VFS operations

file descriptor: OS representation of file

  • supported operations: open, read, write, sendfile, lock, close

inode: persistent data structure, representation of file “index”. this index is important b/c file does not need to be stored contiguously on disk.

  • list of all data blocks
  • device, permissions, size

dentry: directory entry, corresponds to single patch component

  • /users/ada => /, /users, /users/ada
  • file system maintains a dentry cache

superblock: filesystem-specific information regarding the FS layout

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

What does the virtual file system look like on disk?

A

file: data blocks on disk (non-contiguous)

inode: tracks files’ blocks. also resides on disk in some block (contiguous)

superblock: overall map of disk blocks

  • inode blocks
  • data blocks
  • free blocks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an inode?

Pros/Cons?

A

An inode is an index of all disk blocks corresponding to a file

A file is identified by its inode number

The inode holds a list of all blocks that constitute a file + other metadata

Pros:

+ easy to perform sequential or random access

Cons:

  • limit on side of file to total number of blocks that can be indexed by the inode’s linear data structure
17
Q

What is an inode with indirect pointers?

Pros/Cons?

A

An inode is an index of all disk blocks corresponding to a file. When an inode uses indirect points it means that rather than point directly to the blocks of file data, the inode instead points to a block of pointers. This allows the inode data structure to stay small while supporting larger file sizes.

Pros

+ small inode => large file size

Cons

  • file access slowdown
18
Q

What are some disk access optimizations?

A