Linux I/O Flashcards

1
Q

What is the main API for interacting with devices in linux?

A

A virtual filesystem under /dev provides access to all devices, allowing for operations like read() or write().

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

What is the result of creating a socket?

A

A file descriptor

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

What type of connections does a socket support?

A

Reliable connection-oriented byte stream | Reliable connection-oriented packet stream | Unreliable packet transmission

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

What system call is used for a computer to receive data from a socket?

A

The process must make a listen system call on a local socket, creating a buffer and blocking until data arrive.

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

What system call is used for sending data through a socket?

A

A connect system call is used, using the file descriptor of a local socket and the address of a remote socket, if the remote socket accepts a connection is established.

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

List the main POSIX calls for managing the terminal

A

cfsetospeed, cfsetispeed, cfgetospeed, cfgetispeed, tcsetattr, tcgetattr

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

Of which parts does a device driver consist in linux?

A

Two parts, top half runs in the context of the caller and interfaces with the rest of Linux; bottom half runs in kernel context and interacts with the device (hardware).

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

What are the components of the I/O system?

A

The handling of block special files and the handling of charater special devices

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

What is an optimization for I/O operations on block devices?

A

Linux has a cache between the dis drivers and the file system.

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

What is the purpose of the I/O scheduler and what is the Linux scheduler based on?

A

Its purpose is to reorder or bundle read/write requests to block devices to reduce the latency of disk-head movements. The basic Linux scheduler is based on the Linux elevator scheduler.

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

Explain how the linux elevator scheduler works

A

It keeps IOPs sorted in a doubly linked list, ordered by the address of the sector of the disk request, preventing costly disk-head movements. This leads to starvation, though, which led to the inclusion of two additional lists, maintining read / write operations by their deadlines.

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

Explain what are raw block files.

A

These are files that allow programs to access the disk using absolute block numbers, without any regards to the file system.

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

In which instances do character devices support random access?

A

Line disciplines, which serves as a modifiable buffer of a stream of characters.

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

How are additional device drivers loaded into a linux system

A

Through loadable modules. Modules have to be located during loading. The system checks if the resources required by the driver are available. The corresponding interrupt vectors must be set up. Appropriate driver switch table has to be updated and the driver is allowed to run any device specific initialization it may need.

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