Byte content
The file-system API commonly presents a sequence of bytes even when applications interpret records, images or source code.
Code
Bhavya
Trace pathname lookup, separate names from metadata, compare block allocation and explain how journaling limits damage after a crash.
The file-system API commonly presents a sequence of bytes even when applications interpret records, images or source code.
Size, owner, permissions, timestamps, type and block pointers support protection and lookup.
A descriptor references a kernel open-file entry containing mode, current offset and object identity.
read(fd, buffer, count)
write(fd, buffer, count)
seek changes current offset
close releases descriptor
A filename is not usually stored inside the inode. A directory maps a name to an object number; multiple hard links may map different names to the same inode. A symbolic link stores a pathname and can cross file systems.
An absolute path begins at root; a relative path begins at the process’s current directory.
Permission is checked while traversing each directory, not only on the final file.
Directory entries provide the next object identifier; caches may accelerate lookup.
The kernel validates requested access and installs a descriptor in the process table.
| Allocation | Sequential access | Random access | Growth/fragmentation |
|---|---|---|---|
| Contiguous | Excellent | Direct | External fragmentation; hard growth |
| Linked | Good | Slow traversal | Easy growth; pointer overhead |
| Indexed | Good | Direct via index | Index overhead; scalable variants |
The block map and method trade-off will appear here.
Fast to locate runs with word operations; bitmap itself consumes predictable space.
Simple allocation but finding a large contiguous run may require traversal.
Store groups or starting block plus run length when free blocks cluster.
Creating a file may update a directory entry, inode allocation bitmap, inode and data blocks. A crash between writes can leak blocks or expose incomplete metadata. Write ordering, journaling, copy-on-write trees and recovery checks address different parts of this problem.
Record a transaction before applying home-location updates; replay committed work after a crash.
Reconstruct consistency from on-disk structures, often slower on large file systems.
Write changed blocks elsewhere, then atomically switch metadata to the new version.
open("/home/venu/notes.txt")
Mark complete after you can compare all three allocation methods.
Saved only in this browser.