Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 12 File-System Implementation Silberschatz - Operating System…
Chapter 12
File-System Implementation
Silberschatz - Operating System Concepts 9th
File System Structure
Basic file system
I/O control
File-organization module
Logical file system
Devices
Application programs
File-System Implementation
Partitions and Mounting
Each partition can be either “raw,” containing no file system, or “cooked,” containing a file system. Raw disk is used where no file system is appropriate.
Virtual File System
The VFS layer serves two important functions:
It separates file-system-generic operations from their implementation by defining a clean VFS interface. Several implementations for the VFS interface may coexist on the same machine, allowing transparent access to different types of file systems mounted locally.
It provides a mechanism for uniquely representing a file throughout a network. The VFS is based on a file-representation structure, called a vnode, that contains a numerical designator for a network-wide unique file.This network-wide uniqueness is required for support of network file systems. The kernel maintains one vnode structure for each active node.
Overview
boot control block (per volume) can contain information needed by the system to boot an operating system from that volume.
A volume control block contains volume details,such as the number of blocks in the partition, the size of the blocks, a free-block count and free-block pointers, and a free- FCB count and FCB pointers
A directory structure (per file system) is used to organize the files
A per-file FCB contains many details about the file. It has a unique identifier number to allow association with a directory entry
Directory Implementation
Linear List
To create a new file, we must first search the directory to be sure that no existing file has the same name. Then, we add a new entry at the end of the directory
Hash Table
Takes a value computed from the file name and returns a pointer to the file name in the linear list.
Allocation Methods
Linked Allocation
solves all problems of contiguous allocation. With linked allocation, each file is a linked list of disk blocks; the disk blocks may be scattered anywhere on the disk.
Indexed Allocation
Bringing all the pointers together into one location: the index block.
Linked scheme
An index block is normally one disk block. Thus, it can be read and written directly by itself. To allow for large files, we can link together several index blocks
Multinivel Index
Uses a first-level index block to point to a set of second-level index blocks, which in turn point to the file blocks.
Combined Scheme
Used in UNIX -based file systems, is to keep the first, say, 15 pointers of the index block in the file’s inode.
Contiguous Allocation
Is defined by the disk address and length of the first block.
The problem can be seen as a particular application of the general dynamic storage-allocation problem.
Free-Space Management
Grouping
approach stores the addresses of n free blocks in the first free block. The first n−1 of these blocks are actually free. The last block contains the addresses of another n free blocks, and so on.
Counting
These entries can be stored in a balanced tree, rather than a linked list, for efficient lookup, insertion, and deletion
Linked List
link together all the free disk blocks, keeping a pointer to the first free block in a special location on the disk and caching it in memory.
Space Maps
Is a log of all block activity, in time order, in counting format. When ZFS decides to allocate or free space from a metaslab, it loads the associated space map into memory in a balanced-tree structure, indexed by offset, and replays the log into that structure
Bit Vector
Each block is represented by 1 bit. If the block is free, the bit is 1; if the block is allocated, the bit is 0.
Efficiency and Performance
Efficiency
The efficient use of disk space depends heavily on the disk-allocation and directory algorithms in use
Originally, many data structures were of fixed length, allocated at system startup. These structures included the process table and the open-file table. When the process table became full, no more processes could be created.
Performance
Once a seek is performed, the track is read into the disk cache starting at the sector under the disk head.The disk controller then transfers any sector requests to the operating system.Once blocks make it from the disk controller into main memory, the operating system may cache the blocks there.
Recovery
Log-Structured File Systems
These logging algorithms have been applied successfully to the problem of consistency checking. The resulting implementations are known as log-based transaction-oriented
Backup and Restore
System programs can be used to backup data from disk to another storage device, such as a magnetic tape or other hard disk. Recovery from the loss of an individual file, or of an entire disk, may then be a matter of restoring the data from backup.
Consistency Checking
Compares the data in the directory structure with the data blocks on disk and tries to fix any inconsistencies it finds.
NFS
The NFS Protocol
The NFS protocol provides a set of RPC s for remote file operations. The procedures support the following operations:
Searching for a file within a directory
Reading a set of directory entries
Manipulating links and directories
Accessing file attributes
Reading and writing files
Path-Name Translation
In NFS involves the parsing of a path name such as /usr/local/dir1/file.txt into separate directory entries, or components
The Mount Protocol
Establishes the initial logical connection between a server and a client.
Includes the name of the remote directory to be mounted and the name of the server machine storing it. The mount request is mapped to the corresponding RPC and is forwarded to the mount server running on the specific server machine.
Remote Operation
A remote file operation can be translated directly to the corresponding RPC . Conceptually, NFS adheres to the remote-service paradigm; but in practice, buffering and caching techniques are employed for the sake of performance.
Overview
system programs can be used to backup data from disk to another storage device, such as a magnetic tape or other hard disk. Recovery from the loss of an individual file, or of an entire disk, may then be a matter of restoring the data from backup.
Daniela Porras Quiros
2015071255