Slide 1
Slide 1
File-System Interface
Chapter 11: File-System Interface
File Concept
Access Methods
Disk and Directory Structure
File-System Mounting
File Sharing
Protection
Objectives
Directory
Files
F1 F2 F4
F3
Fn
Create a file
Delete a file
List a directory
Rename a file
Advantages:
Since it is a single directory, so its implementation is very easy.
If files are smaller in size, searching will faster.
The operations like file creation, searching, deletion, updating are very easy in
such a directory structure.
Disadvantages:
There may chance of name collision because two files can not have the same
name.
Searching will become time taking if directory will large.
In this can not group the same type of files together.
Two-Level Directory
Separate directory for each user
Advantages:
We can give full path like /User-name/directory-name/.
Diffrent users can have same directory as well as file name.
Searching of files become more easy due to path name and user-grouping.
Disadvantages:
A user is not allowed to share files with other users.
Still it not very scalable, two files of the same type cannot be grouped together in the same user.
Tree-Structured Directories
Tree-Structured Directories (Cont.)
Efficient searching
Grouping Capability
Current directory (working directory)
cd /spell/mail/prog
type list
Advantages:
Very generalize, since full path name can be given.
Very scalable, the probability of name collision is less.
Searching becomes very easy, we can use both absolute path as well as
relative.
Disadvantages:
Every file does not fit into the hierarchical model, files may be saved into
multiple directories.
We can not share files.
It is inefficient, because accessing a file may go under multiple directories.
Tree-Structured Directories (Cont)
Absolute or relative path name
Creating a new file is done in current directory
Delete a file
rm <file-name>
Creating a new subdirectory is done in current directory
mkdir <dir-name>
Example: if in current directory /mail
mkdir count
Advantages:
We can share files.
Searching is easy due to different-different paths.
Disadvantages:
We share the files via linking, in case of deleting it
may create the problem,
If the link is softlink then after deleting the file we
left with a dangling pointer.
In case of hardlink, to delete a file we have to
delete all the reference associated with it.
Acyclic-Graph Directories (Cont.)
Two different names (aliasing)
If dict deletes list dangling pointer
Solutions:
Backpointers, so we can delete all pointers
Variable size records a problem
Backpointers using a daisy chain organization
Entry-hold-count solution
New directory entry type
Link – another name (pointer) to an existing file
Resolve the link – follow pointer to locate the file
General Graph Directory
General Graph Directory (Cont.)
How do we guarantee no cycles?
Allow only links to file not subdirectories
Garbage collection
Every time a new link is added use a cycle detection
algorithm to determine whether it is OK
General Graph Directory
(Cont.)
Advantages:
It allows cycles.
It is more flexible than other directories structure.
Disadvantages:
It is more costly than others.
It needs garbage collection.
11.4 File System Mounting
A file system must be mounted before it can be
accessed
A unmounted file system (i.e., Fig. 11-11(b)) is
mounted at a mount point
Mount Point
11.5 File Sharing
Sharing of files on multi-user systems is desirable
Sharing may be done through a protection scheme
On distributed systems, files may be shared across a
network
Network File System (NFS) is a common distributed file-
sharing method
If multi-user system
User IDs identify users, allowing permissions and
protections to be per-user
Group IDs allow users to be in groups, permitting group
access rights
Owner of a file / directory
Group of a file / directory
File Sharing – Remote File Systems
Uses networking to allow file system access between systems
Manually via programs like FTP
Automatically, seamlessly using distributed file systems
Semi automatically via the world wide web
Client-server model allows clients to mount remote file
systems from servers
Server can serve multiple clients
Client and user-on-client identification is insecure or complicated
NFS is standard UNIX client-server file sharing protocol
CIFS is standard Windows protocol
Standard operating system file calls are translated into remote calls
Distributed Information Systems (distributed naming
services) such as LDAP, DNS, NIS, Active Directory implement
unified access to information needed for remote computing
File Sharing – Failure Modes