OS Module 7: File Systems

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/84

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

85 Terms

1
New cards

What is the primary purpose of a file system?

to enable persistent data storage and organize, protect, and manage stored info

2
New cards

True or False: A file is a randomly generated collection of data in storage

false, a file is logically named unit of persistent storage

3
New cards

Name two examples of storage media where file systems operate

hard disks, SSDs, or tapes

4
New cards

what are the methods of identifying file types

file extensions, magic numbers, file attributes, file contents analysis

5
New cards

file control block (FCB)

a structure that maintains file attributes and location info

6
New cards

what happens when an FCB is loaded into memory

it becomes a file descriptor, temporarily allocated by the OS to manage an active file

7
New cards

what are the 2 ways to access file

sequential access or random access, depending on the storage medium

8
New cards

What is sequential access in file systems

file are read/written one record at a time, in order; tapes and pipes

9
New cards

What is random access in file systems

enabled by disk-based storage, allowing direct access to any part of a file (seek operations)

10
New cards

Sequential access tapes are widely used for backups (T/F)

true

11
New cards

why is tape storage still used

longevity and archival stability

12
New cards

In UNIX systems, what structure is equivalent to Windows' FCBs?

innodes

13
New cards

Linux links don’t allow a single file to exist in multiple directories (T/F)

false, they do allow via file system links

14
New cards

innode

a data structure that stores file metadata, excluding name and content

15
New cards

What major change happened to file system organization as time-sharing systems evolved

Introduction of per-user directories and nested directories

16
New cards

what is a link in UNIX

a pointer to a filethat allows multiple directory entries to reference the same file.

17
New cards

2 types of links

hard and symbolic (soft)

18
New cards

How is a hard link different from a symbolic link

  • Hard link → Same inode, direct reference to data.

  • Symbolic link → Stores path to another file.

19
New cards

files in UNIX systems can be created with what commands

touch, cat, echo

20
New cards

when does linking and unlinking occur?

when a file is created, hard link is established; when a file is deleted, it’s unlinked

21
New cards

Name one restriction of hard links

they can’t span across different file systems

22
New cards

What happens to a file when its link count drops to zero

the file is permanently deleted

23
New cards

POSIX

defines standards for Unix-based operating systems, enabling cross-platform software development

24
New cards

True or False: POSIX defines exactly how every operating system must implement file operations

false, it defines the standards, but OSs can add extensions

25
New cards

files are stored on disks using 4 primary allocation methods:

contiguous, linked, chained, and indexed

26
New cards

which file allocation methods use hybrid methods

chained indexed and multi-level indexed

27
New cards

file allocation relies on 4 operations:

  • Read block at index “k”

  • Write block at index “k”

  • Allocate a block

  • Deallocate a block

28
New cards

in Unix, directories are organized in what structure?

hierchical, with the root directory at the top

29
New cards

What character separates directory elements in Unix paths

A forward slash (/)

30
New cards

True or False: In Windows, paths use a forward slash (/)

False — Windows uses a backslash ()

31
New cards

absolute path

a path that starts from the root directory

32
New cards

What does ".." (dot-dot) refer to in Unix

the parent directory

33
New cards

What does "." (single dot) represent in Unix

the current directory

34
New cards

True or False: Relative paths are always defined starting from the root

false, relative paths start from the current directory

35
New cards

absolute vs relative paths

absolute - defined in relation to the root directory

relative - defined in relation to the current directory

36
New cards

in-line approach

stores attributes and names sequentially; rigid structure (fixed positions)

37
New cards

What is the main drawback of in-line directory naming

fragmentation when renaming or deleting files

38
New cards

reference-based approach

separates attributes (fixed size) from names (variable size)

39
New cards

How does a reference-based naming system help file management

it separates file names from attributes and allows flexible name changes, reducing fragmentation

40
New cards

what are common directory data structures

linear list, linked lists, b-trees, and hash tables

41
New cards

unix file system mounting process

  1. root file system is automatically mounted

  2. mount table structure updated

  3. file system checks

42
New cards

True or False: Windows requires manual filesystem mounting by users

false, windows mounts filesystems automatically; unix typically requires manual mounting

43
New cards

What is filesystem mounting

attaching a filesystem to the system’s directory tree, making it accessible

44
New cards

virtual filesystem (VFS)

An abstraction layer that hides filesystem-specific details from userspace programs; acts as the interface between users and file systems

45
New cards

VFS operates between …

upper and lower layer

46
New cards

VFS upper layer

  • system call layer where a userspace process traps into the kernel to request a service

  • accessed with libc wrapper function

47
New cards

VFS lower layer

  • contains functions pointers

  • allows VFS to delegate operations

  • glue between application requests and filesystem-specific actions

48
New cards

VFS connects userspace programs with filesystems using what

callback functions like read() and write()

49
New cards

file objects in VFS

represents an open file, containing data such as flags and offset

50
New cards

dentry (directory entries)

linkes inodes to file names, acting as the connector between filesystem elements

51
New cards

What is stored in a dentry cache (dcache)

mappings from paths to dentries to speed up file lookup

52
New cards

True or False: Dentries store file data content

false, they store name-to-inode mappings, not data

53
New cards

What does the struct filesystem_type in VFS describe

the type of supported filesystem (e.g., ext4, NTFS)

54
New cards

What happens before a filesystem can be mounted

it must be recognized by the kernel (registered filesystem type)

55
New cards

What is an inode in Unix/Linux

a structure storing metadata abt a file (not the file’s name or content)

56
New cards

What problem does inode use solve for large files

manages fragmentation by tracking which blocks store file pieces

57
New cards

What is a superblock in a filesystem

a structure containing essential metadata abt the mounted filesystem

58
New cards

What kind of information does a superblock contain

filesystem size, inode list, function pointers for filesystem operations

59
New cards

True or False: Each filesystem has exactly one superblock loaded in memory

false, there can be multiple superblocks linked for multiple mounts

60
New cards

What role do super_operations play in VFS

They define function pointers for actions like file creation, deletion, etc., specific to each filesystem

61
New cards

Why is VFS important for portability across different filesystems

it abstracts differences, allowing program to work across ext4, NTFS, and more w/o changes

62
New cards

In contiguous allocation, how are file blocks stored

in sequential, adjacent blocks on the disk

63
New cards

what are the advantages of contiguous allocation

fast performance and simple file access

64
New cards

what are the challenges with contiguous allocation

external fragmentation and file growth issues

65
New cards

What happens if a file in contiguous allocation outgrows its allocated space

it must be relocated or aborted

66
New cards

In linked list allocation, what does each block store

a pointer to the next block

67
New cards

what are the advantages of linked list allocation

no external fragmentation and doesn’t require predefined file sizes

68
New cards

what are the challenges of linked list allocation

random access is inefficient, pointer overhead consumes storage space, loss or corruption of pointers

69
New cards

file allocation table (FAT)

a table-based version of linked allocation that stores block links separately from file data

70
New cards

How does FAT improve file access compared to basic linked allocation

caching the table improves random access speed

71
New cards

In FAT, where is the chain of block links stored

in a separate table at the beginning of the disk

72
New cards

What is the main idea behind indexed allocation

each file has an index block storing pointers to all its data blocks

73
New cards

what are the challenges with indexed allocation

wastes disk space and there’s a file size limitation

74
New cards

what are potential solutions to overcome indexed allocation limits

multi-leveled indexed allocation, file size calculation, chained indexed allocation, and UNIX inodes,

75
New cards

multi-leveled indexed allocation

a file allocation method that uses multiple levels of index blocks to manage large files and reduce limitations in size and efficiency.

76
New cards

How does two-level indexed allocation work

  • Primary index points to secondary indices

  • Secondary indices point to data blocks

77
New cards

What drawback does multi-level indexing have for small files

wastes storage - even small files need multiple index blocks

78
New cards

How is chained indexed allocation different from multi-level indexing

  • Chained: First entry in an index block points to the next index block.

  • Multi-level: Structured tree-like layers of index blocks

79
New cards

what are advantages with chained indexed allocation

files can grow indefinitely and there’s less wasted space

80
New cards

what’s a downside with chained indexed allocation

small files may waste blocks

81
New cards

What is the hybrid allocation scheme used by Unix inodes

  • First 12 data blocks stored directly in the inode.

  • Indirect pointers for larger files

82
New cards

what are the advantages with UNIX inodes

small files are directly accessible, some files use only a single indirect block, huge files = few disk accesses

83
New cards

True or False: Unix inode allocation allows fast access for both small and large files

true

84
New cards

Why might an OS switch from contiguous to indexed allocation mid-way

to support file growth once the file exceeds a thresholdand to improve disk space utilization.

85
New cards

Why are linked list allocation methods better for sequential access

they naturally follow the sequential structure of files