Operating Systems: File System Implementation Flashcards

1
Q

What role do disks play in the file-system structure?

A

Serve as the primary medium for file system storage

Support both random access and sequential access

Provide the physical basis onto which logical file systems are mapped

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

What are the two independent design challenges in file systems?

A

Determining how the file system should appear to the user

Designing algorithms and data structures to map the logical file system to physical storage

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

How does a layered approach benefit file system implementation?

A

Separates user-level file access from low-level disk operations

Enhances efficiency by organizing responsibilities into distinct layers

Allows for independent evolution of file-system components

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

What are the layers in the layered file system diagram?

A

What are the layers in the layered file system diagram?

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

Describe the four layers involved in a file system’s design.

A

Logical File System:

Manages metadata, protection, and path resolution

File Organisation Module:

Maps logical file names to physical disk blocks

Tracks and allocates free space/blocks

Basic File System:

Performs low-level disk operations (e.g., reading/writing blocks)

I/O Control:

Coordinates communications between the file system and I/O devices

Optimizes throughput and minimizes latency

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

What are the key on-disk data structures in a file system?

A

Boot Control Block: Stores boot-related information

Volume Control Block: Contains details such as total blocks and free blocks

Directory Structure: Organizes file names and metadata pointers

File Control Block (FCB): Holds file metadata (e.g., permissions, ownership, location)

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

What information is typically stored in a File Control Block (FCB)?

A

File permissions

File dates (creation, access, write)

File owner, group, and access control list (ACL) details

File size

Data blocks or pointers to file data blocks

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

What are the main in-memory data structures used in file system implementation?

A

Mount Table: Tracks mounted volumes

Directory Cache: Accelerates directory lookups by reducing disk I/O

Open File Tables:

System-wide table for open files

Per-process tables for file descriptors

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

What purpose does the Mount Table serve in memory?

A

Keeps track of which volumes are currently mounted

Enables efficient management and access of multiple file systems

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

How does a Directory Cache improve file system performance?

A

Reduces the need for repetitive disk I/O during directory lookups

Enhances responsiveness for frequently accessed directories

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

What concept is illustrated by in-memory file system structure diagrams?

A

The interaction between kernel memory and user space

Maintenance of directory structures, file control blocks, and open file tables

The flow from secondary storage to active file operations

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

What are the key considerations regarding partitions and mounting?

A

Partitions may be “cooked” (with an existing file system) or raw (a sequence of blocks)

The boot block can point to a boot volume or to a separate boot loader

The root partition contains the OS and must be mounted at boot time

During mounting, file system consistency is checked and corrected if necessary

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

What is the purpose of the Virtual File System (VFS) in modern operating systems?

A

Provides a unified API for multiple file system types

Hides the complexity of handling different disk formats and network file systems

Enables seamless file access across various storage devices

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

Which file systems are commonly supported by VFS?

A

EXT (e.g., ext4 for Linux)

NTFS for Windows

APFS for macOS and iOS

FAT for removable drives and embedded systems

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

Outline the three layers of the VFS design.

A

File-System Interface (Top Layer):

Implements system calls such as open(), read(), write(), and close()

VFS Interface Layer (Middle Layer):

Defines standard objects and operations using vnode structures

Actual File-System Implementations (Bottom Layer):

Contains file-system-specific drivers (e.g., ext4, NTFS, NFS) that implement the VFS functions

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

What is the role of the schematic view of the Virtual File System?

A

Demonstrates how local and remote file systems are integrated via the VFS

Illustrates the abstraction layer that decouples application calls from hardware specifics

17
Q

What are the two primary directory structures used in file systems?

A

Linear List

Hash Table

18
Q

What are the characteristics of a Linear List directory structure?

A

Each directory entry contains a file name and a pointer to file metadata

Searching requires a full linear scan, resulting in O(n) time complexity

Simple implementation but inefficient for large directories

19
Q

What are the advantages and challenges of using a Hash Table for directory implementation?

A

Advantages:

Provides O(1) average time complexity for lookup, insertion, and deletion

Challenges:

Requires a well-designed hash function

Must incorporate collision resolution techniques such as chaining

20
Q

What is a Linear List directory structure?

A

A simple directory structure where each entry contains a file name and a pointer to file metadata.

Searching requires scanning the entire list (O(n) time complexity).

Simple to implement but inefficient for large directories.

21
Q

What is a Hash Table directory structure and what are its key characteristics?

A

Uses a hash function to map file names to indexes.

Offers O(1) average time complexity for lookup, insertion, and deletion.

Requires a well-designed hash function and collision resolution techniques (e.g., chaining)

22
Q

What are the three main file allocation methods used by file systems?

A

Contiguous Allocation

Linked Allocation

Indexed Allocation

23
Q

How does Contiguous Disk Space Allocation work and what are its drawbacks?

A

Each file occupies a set of contiguous blocks on the disk.

Requires only the starting block and length to manage a file.

Drawbacks include difficulty in finding space, external fragmentation, and the potential need for compaction (either off-line or on-line).

24
Q

What is Modified Contiguous Allocation and how do modern file systems use it?

A

Uses extent-based allocation where an extent is a contiguous set of disk blocks.

Extents are allocated based on the file’s expected size.

A file may consist of one or more extents, and if free space follows the current extent, it is extended; otherwise, a new extent is created and linked.

Used in file systems like ext4 (Linux) and NTFS (Windows).

25
How does Linked Allocation store file data on disk?
A file is stored as a linked list of blocks scattered across the disk. Each block contains both data and a pointer to the next block in the sequence, with a null pointer marking the end. It avoids external fragmentation but results in inefficient random access and may require many I/O operations and disk seeks.
26
What is the File Allocation Table (FAT) variation in file allocation methods?
A hybrid approach that uses a table stored at the beginning of the disk. Each entry in the table represents a block and stores the index of the next block, forming a chain. Includes a free space tracker to mark available blocks and error management to flag bad blocks. Cacheable in memory for faster traversal, though pointer corruption can lead to file corruption.
27
What is Indexed Allocation and what benefits does it provide?
Allocates a dedicated index block for each file that stores pointers (addresses) to all its data blocks. Allows file data blocks to be scattered across the disk while still providing efficient sequential and random access. The file's metadata includes a reference to its index block.
28
What is an example of how Indexed Allocation is implemented in a file system?
A file is represented by an index block that holds pointers to all of its data blocks. The data blocks can be located anywhere on the disk, and the index block ensures quick access regardless of physical placement.