File System Implementation Flashcards

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 _____

A

free, in-use

22
Q

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

A

data, inode

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

A

superblock

25
Q

Each inode is referred to by an inode _______

A

number

26
Q

We can calculate where the inode is on the disk with the inode _______

A

number

27
Q

To get the inode location, what two steps do we do?

A
  1. Calculate offset into the inode region
    (inode #) * sizeof(inode)
  2. Add start address of the inode table
28
Q

Disks are not byte addressable, but ______ addressable

A

sector

29
Q

On disk, the address advances by ______ size, which is typically ____ bytes

A

sector, 512

30
Q

If we need to fetch something at 20kb, the sectorSize would be __

A

40

31
Q

An inode contains ______ that stores information about actual file data

A

metadata

32
Q

The indoe may contain direct _______ to data blocks belonging to the file

A

pointers

33
Q

Since inode size is limited, the number of _______ is limited, and the ____ ____ is limited

A

pointers, file size

34
Q

Why do we use a multi-level index?

A

To store larger files

35
Q

REVIEW MULTI-LEVEL INDEX SLIDES

A

REVIEW MULTI-LEVEL INDEX SLIDES

36
Q

Contiguous allocation has each file occupy a set of contiguous _______

A

blocks

37
Q

In contiguous allocation, we only need the _____ _______ and length

A

start address

38
Q

What are two pros of contiguous allocation?

A
  • Simple

- Efficient sequential and random access

39
Q

What are three cons of contiguous allocation?

A
  • External fragmentation
  • Files may not be able to grow
  • Compaction is possible but expensive
40
Q

In linked allocation, a file is a _______ _____ of blocks

A

linked list

41
Q

In linked allocation, blocks can be anywhere and each block has a _______ to the next block

A

pointer

42
Q

In linked allocation, we need the _____ and ____ block and we must traverse the chain to reach the ________ block

A

start, end, desired

43
Q

What are three pros of linked allocation?

A
  • Simple (only need 2 addresses)
  • Doesn’t waste space
  • Support dynamically growing files
44
Q

What are two cons of linked allocation?

A
  • Expensive random access

- Reliability

45
Q

What is the process that happens when we do open(“/foo/bar”)?

A
  • 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
Q

When the inode is consulted for a read, we need to update the ______ _________ time and the file ______

A

last accessed, offset

47
Q

When we close a file, we need to _______ file descriptor, and use _____ to persist file data

A

deallocate, fsync

48
Q

Closing a file does not perform any disk ____

A

I/O

49
Q

write() may allocate new _______

A

blocks

50
Q

write() needs to update the data ______ and data _______

A

block, bitmap

51
Q

write() needs what 5 I/O operations?

A

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
Q

In addition to the five I/Os required for write(), there could be more I/O required for file _______ and space allocation for _______ entry

A

creation, directory