OS - 3 - Files
OS - 3 - Files
K PAVAN KUMAR
Dept. Of CSE
VFSTR University
Secondary Storage Structure
• File Systems - file concept, access methods
• Directory structure,
• File system mounting,
• File sharing protection;
• File-system structure,
• File system implementation,
• Directory implementation,
• Allocation methods,
• Free space management.
File
• To find a record in the file, we first search the index and then by the
help of pointer we access the file directly.
Ex: of Index and Relative Files
Directory structure
Directory
• Create a file
• Delete a file
• List a directory
• Rename a file
• Single-level directory
• Two-level directory
• Tree-structured directory
• Acyclic graph directory
• General graph directory structure
Single-level directory
• Simplest directory structure.
• In it, all files are contained in the same directory
Advantages:
• Implementation is very easy.
• If the files are smaller in size, creation, searching, deletion, updating
will become faster.
Disadvantages:
• There may chance of name collision because two files can not have
the same name.
• If the files are larger in size, creation, searching, deletion, updating
will become slow.
• This can not group the same type of files together.
Two-level directory
• Create a separate directory for each user.
• Each user has their own UFD (user files directory).
• System’s MFD(master file directory) is searches whenever a new user
id=s logged in.
Two-level directory
Advantages:
• We can give full path like /User-name/directory-name/.
• Different users can have the same directory as well as the file name.
• Searching of files becomes easier due to pathname 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 structure
• The tree has a root directory, and every file in the system has a
unique path.
Tree structure
• Efficient searching
• Grouping Capability
• Current directory (working directory)
• cd /spell/mail/prog
• type list
Advantages:
• Share files.
• Searching is easy due to different-different paths.
Disadvantages:
• We share the files via linking, in case deleting it may create the
problem,
• If the link is a soft link then after deleting the file we left with a
dangling pointer.
• In the case of a hard link, to delete a file we have to delete all the
references associated with it.
General Graph Directory
Advantages:
• It allows cycles.
• It is more flexible than other directories structure.
Disadvantages:
• It is more costly than others.
• It needs garbage collection.
File System Mounting
Ways are:
• Removable storage devices
• Centralized file hosting server installations on networks
• World Wide Web-oriented hyperlinked documents
• Distributed peer-to-peer networks
File Sharing – Remote File Systems