File System Implementation Flashcards

(52 cards)

1
Q

What are the 4 layers in the big picture of the file system?

A

Top: file-system interface
VFS interface
Local/Remote file system
Disk/network

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

There are ___ aspects for implementing a file system

A

two

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

The two aspects for implementing a file system are _____ ________ and ______ _______

A

data structures, access methods

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

For file system data structures, there can be ________ data structures or _________ structures

A

On-disk, in-memory

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

On-disk data structures hold the directory ______, number of ______, _______ of free blocks, _____ information, etc

A

structure, blocks, location, boot

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

In-memory structures are for _______ file system at run-time and ________

A

managing, caching

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

Access methods handle ____ made by processes to open, close, read, write, etc

A

calls

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

We organize the disk by dividing it into ______

A

blocks

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

Disk block sizes are ______

A

fixed

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

Disk blocks are addressed from 0 to ____

A

N-1

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

What are the two types of disk blocks?

A

Data blocks and metadata blocks

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

Data blocks file actual ____

A

data

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

Metadata blocks ________ data

A

manage

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

What are example of metadata blocks?

A

inode, superblock, bitmaps, etc

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

What are data regions?

A

It reserves blocks to store user data

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

The file system has to track which data blocks track _____, size of ____, the file’s ______, etc

A

files, files, owner

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

The file system has to reserve some space for a ______ table

A

inode

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

An inode table is an _____ of on-disk inodes

A

array

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

If the inode table occupies 5 4kb blocks, and the inode size is 256 byte, how many inodes does the file system contain?

A

80

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

We can use ______ to track whether inodes or data blocks are free or allocated

A

bitmaps

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

In a bit map, a 0 indicates ______ and 1 indicates _____

22
Q

A _____ bitmap tracks data regions and an ______ bitmap tracks inode regions

23
Q

What does a superblock contain? Give examples

A

Necessary information for the particular file system. number of inodes, begin location of inode table, etc

24
Q

When mounting a file system, the OS will read the _________ first to initialize information

25
Each inode is referred to by an inode _______
number
26
We can calculate where the inode is on the disk with the inode _______
number
27
To get the inode location, what two steps do we do?
1. Calculate offset into the inode region (inode #) * sizeof(inode) 2. Add start address of the inode table
28
Disks are not byte addressable, but ______ addressable
sector
29
On disk, the address advances by ______ size, which is typically ____ bytes
sector, 512
30
If we need to fetch something at 20kb, the sectorSize would be __
40
31
An inode contains ______ that stores information about actual file data
metadata
32
The indoe may contain direct _______ to data blocks belonging to the file
pointers
33
Since inode size is limited, the number of _______ is limited, and the ____ ____ is limited
pointers, file size
34
Why do we use a multi-level index?
To store larger files
35
REVIEW MULTI-LEVEL INDEX SLIDES
REVIEW MULTI-LEVEL INDEX SLIDES
36
Contiguous allocation has each file occupy a set of contiguous _______
blocks
37
In contiguous allocation, we only need the _____ _______ and length
start address
38
What are two pros of contiguous allocation?
- Simple | - Efficient sequential and random access
39
What are three cons of contiguous allocation?
- External fragmentation - Files may not be able to grow - Compaction is possible but expensive
40
In linked allocation, a file is a _______ _____ of blocks
linked list
41
In linked allocation, blocks can be anywhere and each block has a _______ to the next block
pointer
42
In linked allocation, we need the _____ and ____ block and we must traverse the chain to reach the ________ block
start, end, desired
43
What are three pros of linked allocation?
- Simple (only need 2 addresses) - Doesn't waste space - Support dynamically growing files
44
What are two cons of linked allocation?
- Expensive random access | - Reliability
45
What is the process that happens when we do open("/foo/bar")?
* Traverse the pathname and thus locate the desired inode * Begin at the root of the file system (/) * In most Unix file systems, the root inode number is 2 * Filesystem reads in the block that contains inode number 2 * Look inside of it to find pointer to data blocks (contents of the root) * By reading in one or more directory data blocks, It will find “foo” directory * Traverse recursively the path name until the desired inode(“bar”) * Check file permissions, allocate a file descriptor for this process and returns file descriptor to user
46
When the inode is consulted for a read, we need to update the ______ _________ time and the file ______
last accessed, offset
47
When we close a file, we need to _______ file descriptor, and use _____ to persist file data
deallocate, fsync
48
Closing a file does not perform any disk ____
I/O
49
write() may allocate new _______
blocks
50
write() needs to update the data ______ and data _______
block, bitmap
51
write() needs what 5 I/O operations?
1 to read data bitmap 1 to write to the bitmap 2 to read and then write the inode 1 to write the block itself
52
In addition to the five I/Os required for write(), there could be more I/O required for file _______ and space allocation for _______ entry
creation, directory