Chapter 10: File Systems Flashcards
A file system (FS)
has the function to implement the concept of files.
A record is a
structure of related data items, possibly of different data types, identified within a file by a record number or a unique key field.
An access method is a set of
operations provided by the OS as part of the user interface to access files. The most common access method is sequential.
A Seek is generally not necessary for __________ record files
Fixed-length record files. Any record can be accessed by directly specifying the record number.
Metadata is information about the format and
organization of a file’s data and is generally stored in a file header
A file header is a
portion of the file preceding the actual data and is visible to only the FS itself.
The magic number is a short sequence of
characters at the start of the file header, which identifies the file type. The file type, in turn, determines which programs are allowed to access and interpret the file.
A file extension is a
sequence of one or more characters following the file name.
A file directory (or folder) is a special-purpose file that
records information about other files and possibly other directories. The directory consists of a set of entries, each containing the name of a file followed by other information necessary to access the file.
A tree-structured directory hierarchy is a collection of __________ organized such that (1) __________, and (2) __________
A tree-structured directory hierarchy is a collection of directories organized such that (1) every directory points to zero or more files or directories at the next lower level, and (2) every file and directory except the root is pointed to by exactly one parent directory at the next higher level.
The root of a tree-structured directory hierarchy is
the highest level directory, which does not have a parent directory.
An absolute path name of a file, uniquely identified by an __________, is the __________ leading from __________ to __________
internal ID, f, is the concatenation of the directory and file names leading from the root to the file f.
A relative path name is a
concatenation of file names starting with the current directory.
Change (Directory Operation)
Change the current working directory to another directory specified by a path name.
Create (Directory Operation)
Create a new named directory and a new entry in the current working directory, which points to the new directory.
Delete (Directory Operation)
Delete directory d specified by a path name. Delete also all files and directories reachable using any path name starting from d.
Move (Directory Operation)
Move a file or directory from one directory to another.
Rename (Directory Operation)
Change the name of a file or directory specified by a path name.
List List the file names and optionally other attributes of all files contained in a directory specified by a path name.
Find (Directory Operation)
Find a file or directory specified by a name.
A directed acyclic directory hierarchy organizes directories such that any directory at a given level may point to zero or more files or other directories at lower levels but also
permits any file or directory to have more than one parent directory.
A reference count is a non-negative integer associated with a file f, which indicates
how many directories are pointing to the file.
A symbolic link (or shortcut) is a directory entry that
points to a file or directory just like a regular entry but is treated differently with respect to deletion. A delete operation only removes the link but not the file itself.
A File control block (FCB) is a
data structure associated with a filename that contains all relevant attributes of the file. FCBs are stored apart from file directories and are pointed to by the corresponding directory entries.
In Unix and other OSs an FCB is called an
i-node.
The open file table (OFT) is a
data structure that keeps track of all files currently in use to facilitate efficient access to and manipulation of the files.
The open file operation prepares a file for
efficient access and manipulation by retrieving relevant file information from the FCB and storing the information in an entry of the OFT. Subsequent accesses to the file then occur via an index into the OFT.
A read file operation
copies data from an open file to a specified area in main memory.
A write file operation
copies data from an area in main memory to a specified open file. A generic sequential write operation has the form:
write i, m, n
A seek operation
moves the current position of an open file to a new specified position. A generic seek operation has the form:
seek i, k
The close file operation
reverses the effects of the open operation by saving the current state of the file in the FCB and freeing the OFT entry.
A disk block is a
fixed sequence of bytes on the disk, which can only be accessed as a single unit using low-level read-block and write-block operations.
In a contiguous block allocation scheme, every file is
mapped into a contiguous sequence of disk blocks. The FCB points to the first disk block. The file length, also maintained in the FCB, determines how many blocks are occupied by the file.
With a linked block allocation scheme, the blocks containing a file may be
scattered throughout the disk. The FCB points to the first block and each block points to the logically next block.
A clustered block allocation scheme links together sequences of
contiguous blocks. The last block of any cluster points to the beginning of the logically next cluster.
A File allocation table (FAT) is an
array where each entry corresponds to a disk block. The FAT keeps track of which disk blocks belong to a file by linking the blocks in a chain of indices.
With an indexed block allocation scheme, file blocks may reside
anywhere on the disk. An index table is provided for each file, which keeps track of the blocks belonging to the file.
Differences between linked and indexed block allocation scheme
The indexed block allocation scheme provides fast random access to file blocks through an index block, but requires additional overhead for storing and maintaining the index. The linked block allocation scheme allows for dynamic allocation and flexible resizing of files, but may have slower random access due to traversing linked lists and increased disk seek time. The choice between the two schemes depends on factors such as the access patterns, file sizes, and trade-offs between random access performance and space efficiency.
A bitmap is a data structure where each bit represents
one disk block. A 1 indicates that the block is allocated and a 0 indicates that the block is free.
We can use the virtual memory techniques discussed in Virtual Memory to treat file I/O as routine memory accesses. This approach, known as __________, allows a part of the virtual address space to be logically associated with the file.
memory mapping a file
The general outline for creating a region of shared memory using memory-mapped files in the Windows API involves first creating a __________ for the file to be mapped and then establishing a view of the mapped file in a process’s virtual address space.
file mapping
To establish a memory-mapped file, a process first opens the file to be mapped with the CreateFile() function, which returns a HANDLE to the opened file. The process then creates a mapping of this file HANDLE using the CreateFileMapping() function. Once the file mapping is done,
the process establishes a view of the mapped file in its virtual address space with the MapViewOfFile() function. The view of the mapped file represents the portion of the file being mapped in the virtual address space of the process—the entire file or only a portion of it may be mapped.
The call to CreateFileMapping() creates a
named shared-memory object called SharedObject.