Week 11 Flashcards

1
Q

What is persistent storage?

A

Holds data regardless of whether the system is powered on/off.

Persistent storage can take several forms, commonly is based on disks.

All components of the OS and applications are kept there and loaded in main memory (RAM) when executed.

Persistent storage tends to be order of magnitude cheaper and slower than RAM so it is not used directly for program execution.

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

What are the requirements for OS storage management?

A

Performance

Support for multi-processing

Security/access control

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

How does the OS keep track of how many inodes and datablocks are in the file system.

A

We can use superblocks.

Note that they depend on the disk size.

I need to use a block (typically the first so it is easy to find) to store them!

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

How does persistent storage look like from the point of view of the OS?

A

It typically looks like an array of blocks where data can be written or read.

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

How is the file system organized?

A

It looks like a tree which organizes units of storage (files) into a hierarchial set of location (directories).

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

How can we keep track of free blocks?

A

Possible solutions:
Free block list
Bitmap: array of bits, one per block (if bit = 0 then the block is free. If bit = 1 it is occupied.)

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

How does the OS keep track of how many inodes and datablocks are in the filesystem?

A

We will use superblocks.

The size will depend on the disk size.

Typically we put the block first so its easy to find.

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

What is an inode?

A

In UNIX systems, inode tends to be a generic name for structures that hold file information.

It stands for index mode.

Inodes are typically arranged as part of a data structure on disk

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

What is the inode number?

A

Specifies a specific node within this structure.

This is called the i-number.

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

What is a sector?

A

A disk is internally partitioned into sectors, and a whole sector must be retrieved at a time.

Note sector size is determined by the disk hardware.

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

What is a block?

A

A block is a unit of allocation, the minimum of space the OS can allocate to a file.

Typically, block size = sector size * 2^n with n determined by the OS.

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

How does the OS retrieve content of the disk?

A

Compute which sector within the block the content is.

Retrieve the sector.

Retrieve the content from within the sector.

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

What is an indirect pointer.

A

An indirect pointer points to a disk block storing direct pointer.

A double indirect pointer points to a block containing indirect pointers.

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

In UNIX/LINUX there are two main interfaces to access files from programs

A

Libc I/O functions: fopen, fclose, fread, fwrite…

POSIX system calls: open, close, read, write…

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

What do the following do?

O_CREAT

O_WRONLY

O_TRUNC

A

O_CREAT: create the file if it does not exist

O_WRONLY: onlu open the file for writing

O_TRUNC: truncate the file to 0 bytes if it exists

Returns a file descriptor representing the file.

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

What is strace?

A

run a program while tracing all the system calls it issues.

17
Q

What does the following do?

ssize_t read(int fd, void buf, sizet count);

A

ssize_t read(int fd, void buf, sizet count);
* The first parameter is an open file descriptor
* The second parameter is a pointer to a buffer to store data
* The third parameter describes how many bytes should read at most
* Returns the number of bytes read

18
Q

What does the following do?
~~~
ssizet write(int fd, const void *buf, sizet count);
~~~

A

The first parameter is an open file descriptor

The second parameter is a pointer to a buffer containing data to be written

The third parameter describes how many bytes should written

Returns the number of bytes written