2. Processes and File Handles Flashcards

1
Q

What do threads do?

A

Threads save processor state

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

What does the address space do?

A

Address spaces map the addresses used by processes (virtual addresses) to real memory addresses (physical addresses)

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

What do files do?

A

Files map offsets into a file to blocks on disk

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

What is the difference between a file and a file-like object?

A

File-like objects look like files to a process but are not actually stored on disk and may not completely obey file semantics

Ex: You cannot seek on a network socket or open certain network-mounted files

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

What does a process do?

A

Processes organize the other operating system abstractions (threads, address spaces, files, etc) and represent a single thing that the computer is “doing”

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

What is a file descriptor?

A

A file descriptor is an index into a process file table. The data at this index position is a pointer to a file handle.

Each process has its own set of pointers (indexed by file descriptors) for any file handles it has open.

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

What is a file handle?

A

An object that contains a reference to a separate file object also maintained by the kernel.
The file handle contains the access permissions and offset of the file it points to

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

Lay out the three levels of indirection in the file system.

A
  1. File descriptor –> file handle
  2. File handle –> file object
  3. File object –> blocks on disk
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why have three levels of indirection in a file system?

A

It allows different parts of the file state to be shared separately.

File descriptors are private to each process. File handles can be shared by multiple processes through fork(). File objects hold other file state and can be shared transparently between many processes.

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

One design principle of the OS is to separate these two things.

A

Separate policy from mechanism.

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

One design principle of the OS is to facilitate control or sharing of resources. How is this accomplished?

A

The OS facilitates control or sharing of resources by adding levels of indirection. These levels can be given different degrees of access.

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