W4 - File Systems Flashcards

(86 cards)

1
Q

Superuser

A

A user account with elevated priveleges at the OS level.
Can perform administrative tasks (e.g. installing software, changing system settings).

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

Do processes run by superusers run in user mode or kernel mode?

A

User mode. They can request privileged operations via system calls.

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

Partial Context Switch

A

On certain events (e.g. timer interrupts), only part of the CPU context is moved to main memory.

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

What is overhead

A

Extra work the system has to do that doesn’t directly help with the task, but is necessary to support it.

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

Overhead Examples

A

Example 1: Switching tasks means you need to save current state and load next state.
Example 2: Extra memory used for managing data (e.g. pointers or metadata)

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

What is a disk partition?

A

A logically separated section of a physical disk that behaves like an independent disk.

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

What is logical deletion of files?

A

When a file is marked as deleted but not physically removed from the disk, allowing possible recovery.

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

What does the Master Boot Record contain?

A

It contains the bootloader and the partition table.

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

Where is the Master Boot Record located?

A

At the start of a disk.

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

What are the limitations of MBR?

A

Supports only 4 primary partitions and up to 2TB of disk space.

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

What is the GUID Partition Table (GPT)?

A

A modern partitioning scheme that uses GUIDs, supports 128+ partititons, and handles disks over 2TB.

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

What is Ext2?

A

A Linux filesystem. [possibly needs to be covered more?]

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

What is a GUID?

A

Globally Unique Identifier. 128 bits long. Used to uniquely identify partitions and partition types, avoiding conflicts.

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

What is a file system?

A

A part of the OS that organizes raw disk blocks into usable files and directories.

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

Name the four main functions of a file system.

A

Disk management - (grouping disk blocks together to form files)

Naming - (Let users/apps find files by name, not by physical location)

Protection - (Controls access to files e.g. read/write/execute)

Reliability/Durability - (Ensures data isn’t lost despite crashes or hardware failure)

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

Describe the user’s view of a file.

A

As durable data, accessible by name.

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

How does the system view a file via system calls?

A

As a collection of bytes.

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

How does the OS view a file internally?

A

As a collection of logical blocks.

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

What’s the difference between a block and a sector?

A

A block is a logical OS-level transfer unit; a sector is a hardware-level physical transfer unit.

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

What is a typical block size in UNIX?

A

4 KB.

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

Are files stored as blocks?

A

Yes, file data is broken into 4 KB (or similar) blocks and stored on the disk.

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

What happens if a file is smaller than a block?

A

The file still takes up one full block — the rest is unused but reserved (this is called internal fragmentation).

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

What does the OS use to track which blocks belong to which files?

A

Data structures like inodes, FAT tables, or metadata depending on the file system.

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

Can two files share the same disk block?

A

No — each file gets its own blocks. Sharing isn’t allowed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How many blocks do 10x 13-byte file take on a 4KB-block system?
10 blocks, one block for each file.
26
How many blocks does a 6KB file take on a 4KB-block system?
2 blocks.
27
What is the relationship between blocks and sectors?
A block consists of one or more sectors (e.g., 4KB block = 8 × 512B sectors).
28
What happens when you write a 700-byte file? 1 block = 4KB 1 sector = 512B
The OS allocates a 4KB block and writes the file across 2 sectors. It has to fetch the entire 4KB block.
29
Can the disk write just part of a sector?
No — only full sectors can be written. Partial writes require reading-modifying-writing a full sector.
30
What is a file in an operating system?
A named, persistent abstrction for non-volatile storage created and used by processes.
31
What is the name of the information about a file stored within that file?
Metadata
32
What is file metadata?
File owner, size, timestamps, and access rights.
33
What is file metadata?
Information about a file.
34
What are examples of file metadata?
Owner, file size, last modified date, access permissions (read, write, execute).
35
How are file permissions handled in Unix systems?
With R (read), W (write), X (execute) for owner, group, and others.
36
How are file permissions handled in Windows?
Using Access Control Lists (ACLs).
37
State four requirements a file system should have to be effective.
Variable file sizes, concurrent access with protection, file lookup, and disk space management.
38
What are the components of a file system?
File path Directory File number File Inode Data blocks (one block = multiple sectors)
39
Does the OS need to understand the internal format of files like .docx or .jpeg?
No — the OS just sees a byte stream. Applications interpret file formats.
40
What is a magic number in a file?
A special sequence of bytes at the start of a file that helps identify its type (e.g., JPEG starts with 0xFFD8FF).
41
How does file naming differ across operating systems?
UNIX is case sensitive. Windows is case-insensitive but case-preserving.
42
What is a directory in a file system?
A special file whose data blocks contain a directory table - a list of filename to inode number mappings.
43
What types of entries can a directory contain?
Files and other directories.
44
What is an inode number?
A unique identifier assigned to each file or directory; it points to the inode that stores the file's metadata and data block locations.
45
What structure results from directories containing other directories?
A hierarchical tree-like file system.
46
What is an absolute path name?
A path that starts from the root directory and uniquely identifies a file
47
What is a relative path name?
A path relative to the current working directory
48
What character separates directories in UNIX/Linux paths, and how does it compare to Windows paths?
Forward slash in UNIX/Linux. Backwards slash in Windows.
49
What do these represent when using cd: . .. ~ ~username
. is current directory. .. means parent directory. ~ is current users home directory. ~username is home directory of user 'username'
50
What does the system-wide open file table store?
Information about all currently open files, such as name, size, and ownership.
51
What does the per-process open file table store?
It stores pointers to the system open file table and process-specific info like current position in the file.
52
Why might the current file position pointer be stored in either the system-wide open file table or the per-process open file table depending on implementation?
It depends on whether the file is shared between processes or opened independently.
53
What is the purpose of the per-process open file table?
To keep track of each process’s view and interaction with the open files.
54
What happens when we open a file?
The open() system call reads in the inode information from disk, and stores it in the system-wide open file table in memory. An entry is added to the per process open file table in memory referencing the system wide table in memory, and a pointer into the per-process table is returned to us by the open() system call.
55
The open() system call returns a pointer into the per-process table. What is this called in UNIX / Windows?
UNIX: File descriptor Windows: File handle
56
What happens when we close a file?
The per-process table entry is freed. Any data currently stored in memory cache for this file is written out to disk if necessary.
57
What happens if multiple processes open the same file?
They each have entries in their per-process tables pointing to the same system-wide entry.
58
Purpose of locks
Control simultaneous access to files.
59
What are the three levels of users?
Owner Group World (everyone)
60
What are the three file permissions?
Read (4) Write (2) Execute (1)
61
chmod 744 zzz.py Explain the number code.
Each digit is in the range 0-7, a three bit number. Leftmost bit is read, middle bit is write, rightmost bit is execute. Each three bit number corresponds to the level of user. Leftmost is owner, middle is group, rightmost is world. 744 would be 111 100 100, which means rwx r-- r--. We see the file owner gets all file permissions, whereas the rest only get read permissions.
62
What is the File System Hierarchy Standard?
A guideline used mainly by Unix-like OSes to define a consistent directory structure.
63
Benefits of File System Hierarchy Standard
Promotes interoperability between software and systems. Ensures a predictable layout for system admins and devs.
64
What is an inode?
A data structure that stores metadata about a file or directory, and pointers to data blocks on disk.
65
What are some specific attributes inodes record information about?
File size Device ID Owner (UID, GID) File mode (permissions) Timestamps (ctime, mtime, atime) Link count Pointers to disk blocks containing the file’s content
66
What are hard links in Linux?
Hard links share the same inode number and refer to the same data blocks. Deleting one file doesn't affect the other until the link count reaches zero. Hard linking of directories is not allowed.
67
What are symbolic (soft) links in Linux?
Symbolic links contain the full path name of the original file. Similar to a Windows shortcut. If the original file is deleted, the symbolic link becomes dangling.
68
Why would hard links be useful?
Allows multiple names (aliases) for the same file. Saves disk space by referencing the same data blocks from different file names.
69
Why would symbolic (soft) links be useful?
Provides flexibility by pointing to files or directories located anywhere. Can link across file systems, unlike hard links.
70
What are the differences between hard links and symbolic links?
Hard Links: Same inode number as the original, share the same data blocks, deleting one doesn’t affect the other, can’t link directories, can’t cross filesystems. Symbolic Links: Different inode number, points to the file's path, becomes dangling if the original is deleted, can link directories, can cross filesystems.
71
What's the link count in an inode?
How many paths lead to the inode.
72
What command lets you look at all the metadata?
stat aFile.txt
73
Linux hard link command
ln a.txt c.txt Creates a new file c.txt pointing to the same inode number as a.txt
74
Linux soft link command
ln -s a.txt c.txt A new inode is created for c.txt. The data in this new inode is just the path to the original file a.txt.
75
What is indexed allocation in the context of file systems?
A method of file storage where each file has an index block (often an inode in Unix-like systems) that contains pointers to all the file's data blocks, enabling non-contiguous storage of file data.
76
What is stored in the inode table?
All inodes in the file system.
77
Why is indexed allocation advantageous compared to contiguous allocation?
It allows files to grow dynamically and use non-contiguous blocks, reduces external fragmentation, and provides efficient random access to any part of a file.
78
What is special about EXT2 inodes according to the note on the slide?
EXT2 stores file metadata in inodes, including information like file size, owner, permissions, timestamps, and block pointers.
79
How does an inode keep track of which disk blocks belong to a file?
It uses a system of direct and indirect pointers to track which disk blocks contain the file's data. For small files, direct pointers point directly to data blocks. For larger files, indirect pointers reference blocks that contain more pointers.
80
What are direct pointers in an inode?
Direct pointers in an inode point directly to data blocks that contain the file's contents. These are used for accessing the first portion of a file, providing the most efficient access for small files.
81
What is the purpose of indirect pointers in an inode?
To allow the file system to address larger files by pointing to disk blocks that contain more pointers rather than actual file data. This creates a tree-like structure that can reference a much larger number of data blocks than direct pointers alone.
82
How many levels of indirect pointers are typically used in UNIX file systems?
Three levels of indirect pointers: single indirect, double indirect, and triple indirect pointers.
83
If each block is 4KB and can hold 1024 pointers, what is the maximum file size addressable with a triple indirect pointer?
4TB (4KB × 1024 × 1024 × 1024 = 4TB)
84
Asides from inodes, what other main file allocation methods are there?
Contiguous, Linked Lists, File Allocation Table (FAT)
85
What is external fragmentation?
When free storage space is divided into small, non-contiguous blocks, making it impossible to store large files ven though there's enough total free space.
86