★ Must-know
Further detail
A text file is a sequence of characters organized into lines and possibly pages.
A source file is organized as a sequence of functions, each containing declarations followed by executable statements.
An executable file contains code sections that a loader can bring into memory and execute.
★ Must-know
Typical file attributes are: name, identifier, type, location, size, protection, creation, modification, and use time, date, and user identification
Creating a file requires finding space in the file system and adding an entry for the new file to the directory.
Writing or reading a file uses a system call and a file-position pointer that advances after each operation; a shared current-position pointer can serve both operations when a process uses one operation at a time.
📌 Truncating a file releases its contents and resets its length to zero while preserving its attributes, whereas deleting a file also removes its directory entry and releases its file space.
Further detail
📌 A file name is the human-readable symbolic name, whereas its identifier is a unique, usually numeric, non-human-readable tag within the file system.
A file's location attribute points to the device and location where the file is stored, while its size records its current size and possibly its maximum allowed size.
Repositioning, or seeking, changes the current file-position pointer without necessarily performing I/O, while deleting releases the file's space and removes its directory entry.
The per-process open-file table tracks a process's open files and access rights, while the system-wide table stores process-independent file information and an open count.
★ Must-know
Further detail
Sequential access follows the file pointer; direct access jumps to a numbered block.
★ Must-know
Controlled file operations include:
A compact protection scheme classifies users as owner, group, or universe, with three permission fields that may encode read, write, and execute access as rwx bits.
Further detail
📌 Per-file passwords require users to remember multiple passwords, while one password shared across all files makes protection all-or-none if that password is discovered.
★ Must-know
On-disk structures include:
In-memory structures include:
Further detail
In UFS, the volume control block is called the superblock, while in NTFS volume information is stored in the master file table.
Closing a file removes its per-process entry and decrements the system-wide open count; when the count reaches zero, updated metadata is written back and the system-wide entry is removed.
A deleted linear-list directory entry can be marked unused, linked to a free-entry list, or replaced by the last entry while the directory length is decreased.
A chained-overflow hash table resolves collisions by storing each hash entry as a linked list and adding colliding entries to that list.
A linear list searches entries; a hash table uses a filename-derived value to find one.
★ Must-know
Contiguous allocation supports both sequential and direct access and usually requires few disk seeks.
First-fit and best-fit are common strategies for choosing a free hole, but repeated allocation and deletion can cause external fragmentation.
Further detail
A contiguous file of n blocks starting at block b occupies blocks b through b + n − 1.
Compaction copies files elsewhere and reallocates them from one large free region, reducing external fragmentation at high cost.
📌 Preallocating a file's final size can waste space through internal fragmentation, whereas allocating too little space can prevent the file from growing without relocating it.
★ Must-know
📌 Linked allocation supports sequential access efficiently, whereas finding a particular block requires following pointers from the beginning and is inefficient for direct access.
Further detail
Linked allocation uses space for pointers, and grouping blocks into clusters reduces pointer overhead but can increase internal fragmentation.
A damaged pointer in linked allocation can mislink a file into the free-space list or another file, while doubly linked lists or storing file names and relative block numbers in blocks are partial solutions.
★ Must-know
Further detail
Indexed allocation incurs index-pointer overhead that is generally greater than the pointer overhead of linked allocation.
Large files can be supported by: linking index blocks, using multilevel indexes, combining direct and indirect pointers in an inode
In the described combined scheme, the first 12 inode pointers address direct data blocks and the next three point to indirect blocks.
With 4 KB blocks and 12 direct pointers, the combined scheme can directly access up to 48 KB of file data.
★ Must-know
📌 An SSD is nonvolatile memory used like a hard drive and can be faster, more reliable, and lower-power than a magnetic disk because it has no moving parts, seek time, or rotational latency.
Further detail
Disk bandwidth is the total number of bytes transferred divided by the time from the first service request to completion of the last transfer.
A head crash occurs when a disk head damages the magnetic surface of a platter.
SSDs are more expensive per megabyte, have less capacity than larger hard disks, and may have shorter life spans than hard disks.
★ Must-know
SSTF selects the pending request nearest the current head position and moves the head 236 cylinders for the example queue starting at cylinder 53.
SCAN services requests while moving the disk arm from one end of the disk to the other, then reverses direction; it is also called the elevator algorithm.
📌 C-SCAN services requests in one direction across the disk and returns to the beginning without servicing requests on the return trip, whereas SCAN services requests in both directions.
Further detail
FCFS services disk requests in arrival order; for the queue 98, 183, 37, 122, 14, 124, 65, 67 starting at cylinder 53, it moves the head 640 cylinders.
SSTF can cause starvation because a continuing stream of nearby requests may indefinitely delay a request farther from the current head position.
📌 LOOK and C-LOOK reverse or wrap around at the final request in a direction rather than traveling to the physical end of the disk.
★ Must-know
Low-level formatting divides a blank magnetic disk into sectors and writes each sector's header, data area, and trailer.
Preparing a disk for file storage requires partitioning it into one or more groups of cylinders and then logically formatting it by writing initial file-system structures.
Further detail
A sector's data area is usually 512 bytes, while its header and trailer contain controller information such as the sector number and error-correcting code.
During disk I/O, the controller calculates and stores an error-correcting code when writing a sector and recalculates it when reading to detect data corruption.
Initial file-system structures can include maps of free and allocated space and an empty directory, while grouping blocks into clusters can improve efficiency.
📌 Raw I/O accesses a disk partition as a sequential array of logical blocks without file-system data structures, whereas logical formatting creates those structures for file-based use.
Physical formatting lays out sectors; partitioning divides the disk; logical formatting creates the file system.
Disk Space Allocation Methods
| Method | Organization | Access and fragmentation |
|---|---|---|
| Contiguous | Consecutive blocks | Direct and sequential access; external fragmentation |
| Linked | Scattered blocks linked by pointers | Sequential access efficient; no external fragmentation |
| Indexed | Block addresses collected in an index | Direct access; no external fragmentation |
Take a 34-question practice quiz on File Systems and Storage Management, with every answer explained.
1. Which description best defines a file in an operating system?
2. Two files contain different kinds of data and have different internal organizations. What best explains this difference?
Memorize the key concepts of File Systems and Storage Management with 89 flashcards.
What is a file?
A named collection of related information recorded on secondary storage.
What determines the meaning of information in a file?
Its creator and user.
How are a file’s information and structure determined?
By its creator, depending on the file type.
Upload your class notes and Revizly writes a study guide, a quiz and flashcards in about a minute.
Study guide maker