Lecture 13 - File Layout Flashcards

1
Q

What is contiguous allocation?

A

Each file occupies a set of contiguous (consecutive) blocks on the disk

Directory entries point to a contiguous block

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

What are the pros and cons of contiguous allocation?

A

Pros: Easy indexing - start & length

Random access well supported

Cons:

Difficult to grow files, must preallocate needed space

Wasteful if not all space is used

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

What is linked allocation?

A

Each file is a linked list of disk blocks

Blocks may be scattered anywhere

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

What are the pros and cons of linked allocation?

A

Pros: Simple - need only starting address

can grow anywhere in the file - middle, ends

Good for sequential access

Cons: Bad for random access

Slow - need to read through sequentially to find the rquired part of a file

Can be unreliable - system crash can completely mess up a file that was busy being updated

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

What is indexed allocation?

A

Each file has an index block which points to all the blocks of the file

Directory entry points to this index block

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

What file layout does UNIX use?

A

Index nodes

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

How do unix index nodes work?

A

Disk has inode table that contains inodes of all files in the system

I node contains file attribute data (metadata) and can point to other inodes

Example: mode, owners, timestamps, size, count, block pointers, inode pointers

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

How can free space be managed by a bit vector?

A

Keep a bit vector with one entry per file block

If bit for a given block is 1, implies the block is free, else occupied

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

What are the pros and conds of bit vectors for managing free space?

A

Pros: Easy to find consecutive blocks and update entries

Conds: Must be stored on disk, and thus consumes space

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

How can free space be managed by a linked list?

A

Make all free blocks a linked list so each free block points to the next

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

What are the pros and cons of linked list free space management?

A

Pros: No wasted space

doesn’t matter that free space cant be randomly accessed usually

Cons: Difficult to know total number of free blocks unless its tracked elsewhere

Difficult to group nearby blocks together if they’re freed at different times

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

What is a directory?

A

A file mapping names to metadata/data

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

What are two directory implementations?

A

Linear list of file names with pointers to the data blocks - simple, but time consuming to execute (can be alleviated with sorted list)

Hash table - linear list with hash data structure - decreases search time but may have collisions

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

What is a volume?

A

An entity containing a filesystem

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

What is the difference between formatted and raw partitions?

A

Formatted contains a filesystem i.e. it is a volume

Raw is just a collection of bytes

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

How can a file system become inconsistent

A

If the system crashes while the file system is being updated. So not all info might be correct

17
Q

How can inconsistency be fixed?

A

Clear up afterwards - either start again or try to reconstruct

Stop it from happening - make consistent updates or make updates atomic

18
Q

What is mounting?

A

Telling the system that there is a device there that can service IO requests