Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 11 File-System Interface Silberschatz - Operating System…
Chapter 11
File-System Interface
Silberschatz - Operating System Concepts 9th
File Concepts
File Attributes
The file’s owner might write the file to a USB disk, send it as an e-mail attachment, or copy it across a network, and it could still be called example.c on the destination system
A file’s attributes vary from one operating system to another but typically consist of these:
Name
Identifier
Type
Location
Size
Protection
Time, date, and user identification
File Operations
Writing a file
Make a system call specifying both the name of the file and the information to be written to the file.
Reading a file
Use a system call that specifies the name of the file and where the next block of the file should be put.
Creating a file
Two steps are necessary to create a file
First, space in the file system must be found for the file.
Second, an entry for the new file must be made in the directory.
Repositioning whiting a file
The directory is searched for the appropriate entry,and the current-file-position pointer is repositioned to a given value.
Deleting a file
search the directory for the named file and erase the directory entry.
Truncating a file
Rather than forcing the user to delete the file and then recreate it, this function allows all attributes to remain unchanged but lets the file be reset to length zero and its file space released.
File pointer
This pointer is unique to each process operating on the file and therefore must be kept separate from the on-disk file attributes.
File-open count
Tracks the number of opens and closes and reaches zero on the last close.
Disk location of the file
The information needed to locate the file on disk is kept in memory so that the system does not have to read it from disk for each operation.
Access rights
Information is stored on the per-process table so the operating system can allow or deny subsequent I/O requests.
File Types
If an operating system recognizes the type of a file,it can then operate on the file in reasonable ways
A common technique for implementing file types is to include the type as part of the file name.
executable
object
source code
batch
markup
word processor
library
print or view
archive
multimedia
File Structure
File types also can be used to indicate the internal structure of the file source and object files have structures that match the expectations of the programs that read them.
Internal File Structure
Internally, locating an offset within a file can be complicated for the operating system. Disk systems typically have a well-defined block size determined by the size of a sector. All disk I/O is performed in units of one block, and all blocks are the same size
Access Methods
Sequential Access
Information in the file is processed in order, one record after the other.
Direct Access
a file is made up of fixed-length logical records that allow programs to read and write records rapidly in no particular order.
Directory and Disk Structure
Single-Level Directory
The simplest directory structure is the single-level directory. All files are contained in the same directory, which is easy to support and understand
Two-Level Directory
Each user has his own user file directory (UFD).
Directory Overview
Delete a file
When a file is no longer needed,we want to be able to remove it from the directory
List a directory
We need to be able to list the files in a directory and the contents of the directory entry for each file in the list.
Create a file
New files need to be created and added to the directory.
Rename a file
Because the name of a file represents its contents to its users, we must be able to change the name when the contents or use of the file changes.
Search for a file
We need to be able to search a directory structure to find the entry for a particular file
Traverse the file system
We may wish to access every directory and every file within a directory structure. This technique provides a backup copy in case of system failure.
Tree-Structured Directories
Allows users to create their own subdirectories and to organize their files accordingly
Storage Structure
ctfs
A virtual file system that maintains“contract” information to manage which processes start when the system boots and must continue to run during operation
lofs
A “loop back” file system that allows one file system to be accessed in place of another one
objfs
A “virtual” file system (essentially an interface to the kernel that looks like a file system) that gives debuggers access to kernel symbols
procfs
A virtual file system that presents information on all processes as a file system
ufs, zfs
General-purpose file systems
tmpfs
A “temporary” file system that is created in volatile main memory and has its contents erased if the system reboots or crashes
Acyclic-Graph Directories
Allows directories to share subdirectories and files. The same file or subdirectory may be in two different directories. The acyclic graph is a natural generalization of the tree-structured directory scheme
File-System Mounting
The directory structure may be built out of multiple volumes, which must be mounted to make them available within the file-system name space.
File Sharing
Remote File System
Distributed Information Systems
To make client–server systems easier to manage, distributed information systems, also known as distributed naming services, provide unified access to the information needed for remote computing
Failure Modes
Some kind of state information may be maintained on both the client and the server. If both server and client maintain knowledge of their current activities and open files, then they can seamlessly recover from a failure
The Client-Server Model
Allow a computer to mount one or more file systems from one or more remote machines
Consistency Semantics
These semantics specify how multiple users of a system are to access a shared file simultaneously
UNIX Semantics
In the UNIX semantics, a file is associated with a single physical image that is accessed as an exclusive resource. Contention for this single image causes delays in user processes.
Session Semantics
Immutable-Shared-Files Semantics
Multiple Users
Given a directory structure that allows files to be shared by users, the system must mediate the file sharing. The system can either allow a user to access the files of other users by default or require that a user specifically grant access to the files.
Protection
Types of Access
Access is permitted or denied depending on several factors, one of which is the type of access requested. Several different types of operations may be controlled:
Read. Read from the file.
Write. Write or rewrite the file.
Execute. Load the file into memory and execute it.
Append. Write new information at the end of the file.
Delete. Delete the file and free its space for possible reuse.
List. List the name and attributes of the file.
Access Control
Constructingsuchalistmaybeatediousandunrewardingtask,especially if we do not know in advance the list of users in the system.
The directory entry, previously of fixed size, now must be of variable size, resulting in more complicated space management.
Daniela Porras Quiros
2015071255