File Fat Systsems Flashcards

(21 cards)

1
Q

Virtual File-system

A

Common interface hides– File-system differences

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

Shared Files

A

If we allow multiple links to a file: Supporting links to directories
would allow loops
* Processes scanning
directories might get
trapped
* Not generally allowed

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

Common File Attributes

A
  • Name
  • Unique Identifier
  • File type
  • Location
  • Size
  • Access Control Lists/ Flags
  • Time and Date (accessed, modified, …)
  • Ownership (user/ group)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Common File System Operations

A
  • Create
  • Open
  • Read
  • Write
  • Seek
  • Close
  • Link
  • Unlink
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Contiguous Allocation(File allocation)

A

Each file fills set of adjacent disk blocks in filesystem
Each process is allocated a single continuous block of memory.
Key Points:
Simple & fast: Easy to implement and access.

Base + Limit registers used for protection.

Drawback: Can lead to external fragmentation (small unused holes between blocks).

Hard to grow: If a process needs more memory, it might need to move.

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

Linked-List Allocation

A

Avoids external fragmentation problem as Blocks no longer need to be contiguous (we accept overhead)
* All blocks can be used, but pointers take space– Fragmentation (in this case internal) confined to last block
* Only offers sequential access– Must follow each block link to reach given file position

In linked list allocation, each file is stored as a linked list of disk blocks.
Each block stores:
Data, and a pointer to the next block in the file.

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

Indexed Allocation

A

Each file has an index block that contains pointers to all the disk blocks used by the file.
Key Points:
No need for contiguous space — blocks can be scattered anywhere on disk.

Solves the problem of external fragmentation.

Allows random access to any block of the file.
* Can support holes *– i.e. we don’t allocate space for ‘empty’, 0 filled blocks–

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

pros and cons of index allocation

A

Handles growing files easily.

No external fragmentation.

Fast random access.

Cons:
The index block itself must fit in memory.

Large files may require multi-level indexing (slower).

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

Linked-List: File Allocation Table (FAT)

A
  • Separates pointers from data blocks
  • File Allocation Table (FAT) holds block numbers
    – Keep multiple on-disk copies of FAT for resilience
    Typically copy of whole FAT can reside in memory

– Allows fast access to any block in any file
Every block on disk has an entry in the FAT.

Each FAT entry stores the number of the next block in the file.

Files are chains of blocks linked by FAT entries, not direct pointers in blocks.

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

Inode (Index Node)

A

Stores metadata about a file: permissions, owner, timestamps, size, block pointers, etc.
Has direct, single indirect, double indirect, and triple indirect pointers to data blocks.

Does not store the filename – that’s handled in the directory entry.

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

Direct vs Indirect Pointers

A

Direct: Point straight to data blocks.

Single Indirect: Points to a block that holds more block pointers.

Double Indirect: A pointer to a block that holds pointers to other blocks of pointers.

Triple Indirect: Three levels deep; allows large file support.

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

Reference Count (Hard Links)

A

Counts how many directory entries point to the inode.

When count = 0, data can be deleted.

Hard links can’t span file systems or point to directories

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

Symbolic Links (Soft Links)

A

A file that contains a path to another file.

Can span across file systems.

Can point to non-existent files (broken links).

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

Directory Structure

A

A directory is a file containing mappings of filename → inode number.

Can become fragmented.

Inodes and directory entries are separate.

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

Efficiency and Waste

A

Larger block sizes = more data per block, better for large files but may waste space for small ones.

Systems sometimes allow block fragments to minimize waste.

Balance is crucial between access speed and space efficiency.
If you always use small blocks, large files will be slow to access.
If you always use large blocks, small files will waste space.

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

Open File Descriptor Table

A

Each process has its own File Descriptor Table.

Maps to entries in the system-wide Open File Table.

Includes file position and inode pointer.

Children processes inherit file descriptors from the parent (important for pipes, redirection).

17
Q

Kernel Tables & Inode Caching

A

The kernel stores inodes in an Active Inode Table to speed up file access.

Inode IDs are valid only within their filesystem—kernel uses a hash of inode + device ID.

Each process has its own open file table, while the system maintains global open files and inode cache.

18
Q

Buffering & Block Caching

A

Processes read and write bytes
– Disks handle blocks
Buffering bridges this gap using a buffer cache:

Holds disk blocks in memory.

Enables read-ahead and write-behind.

Improves efficiency using LRU (Least Recently Used) strategies.

19
Q

Filesystem Flush & Sync

A

Buffers marked “dirty” are scheduled to be written to disk.

The system periodically flushes dirty buffers (e.g. on shutdown) to prevent data loss.

sync() system call can force this flush.

20
Q

Delayed Allocation

A

Writing data is delayed to allow efficient allocation.

When data is finally written, it’s often possible to allocate a contiguous block run, reducing fragmentation.

21
Q

Extents

A

Modern filesystems (e.g., ext4) use extents
stores files
Improves read speed, reduces metadata, and minimizes fragmentation.

Each extent records:

Logical file block start.

Number of blocks.

Starting disk block.