0% found this document useful (0 votes)
4 views

File_System_2

Uploaded by

joelbinuphilip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

File_System_2

Uploaded by

joelbinuphilip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Chapter 13: File-System

Interface

Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013
Chapter 13: File-System Interface
 File Concept
 Access Methods
 Disk and Directory Structure

Operating System Concepts – 9th Edition 13.2 Silberschatz, Galvin and Gagne ©2013
Objectives
 To explain the function of file systems
 To describe the interfaces to file systems
 To discuss file-system design tradeoffs, including access
methods, file sharing, file locking, and directory structures
 To explore file-system protection

Operating System Concepts – 9th Edition 13.3 Silberschatz, Galvin and Gagne ©2013
Directory Structure

A collection of nodes containing information about all files

Directory

Files
F1 F2 F4
F3
Fn

Both the directory structure and the files reside on disk

Operating System Concepts – 9th Edition 13.4 Silberschatz, Galvin and Gagne ©2013
Operations Performed on Directory
 Search for a file

 Create a file

 Delete a file

 List a directory

 Rename a file

 Traverse the file system

Operating System Concepts – 9th Edition 13.5 Silberschatz, Galvin and Gagne ©2013
Directory Organization
The directory is organized logically to obtain
 Efficiency – locating a file quickly
 Naming – convenient to users
 Two users can have same name for different files
 The same file can have several different names
 Grouping – logical grouping of files by properties (e.g.,
all Java programs, all games, …)

Operating System Concepts – 9th Edition 13.6 Silberschatz, Galvin and Gagne ©2013
Single-Level Directory
 A single directory for all users

 Naming problem
 Grouping problem

Operating System Concepts – 9th Edition 13.7 Silberschatz, Galvin and Gagne ©2013
Two-Level Directory
 Separate directory for each user

 Path name
 Can have the same file name for different user
 Efficient searching
 No grouping capability

Operating System Concepts – 9th Edition 13.8 Silberschatz, Galvin and Gagne ©2013
Tree-Structured Directories

Operating System Concepts – 9th Edition 13.9 Silberschatz, Galvin and Gagne ©2013
Tree-Structured Directories (Cont.)
 Efficient searching
 Grouping Capability
 Current directory (working directory)
 cd /spell/mail/prog
 type list

Operating System Concepts – 9th Edition 13.10 Silberschatz, Galvin and Gagne ©2013
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: Suppose the current directory is -- “/mail“
 mkdir count

 Deleting “mail”  deleting the entire subtree rooted by “mail”

Operating System Concepts – 9th Edition 13.11 Silberschatz, Galvin and Gagne ©2013
Acyclic-Graph Directories

Have shared subdirectories and files

Operating System Concepts – 9th Edition 13.12 Silberschatz, Galvin and Gagne ©2013
Acyclic-Graph Directories (Cont.)
 Files/subdirectories have two different names (aliasing)
 Only one actual file exists, so any changes made by
one person are immediately visible to the other.
 How do we implement shared files and subdirectories?
 Can duplicate the inode information about the shared
file/subdirectory in each of the subdirectories that
“point’ to the shared structure.
 If some information changes about the file it had to
be updated in several places.
 Have a new directory entry type:
 Link – another name (pointer) to an existing file or
subdirectory.

Operating System Concepts – 9th Edition 13.13 Silberschatz, Galvin and Gagne ©2013
Acyclic-Graph Directories -- Links
 A link may be implemented as an absolute or a relative
path name.
 When a reference to a file is made, the directory is searched.
If the directory entry is marked as a link, then the name of
the real file is included in the link information.
 We resolve the link by using that path name to locate the
real file.
 Links are easily identified by their format in the directory
entry (or by having a special type on systems that support
types) and are effectively indirect pointers.
 The operating system ignores these links when traversing
directory trees to preserve the acyclic structure of the
system.

Operating System Concepts – 9th Edition 13.14 Silberschatz, Galvin and Gagne ©2013
Acyclic-Graph Directories -- Deletion
 If dict /count is deleted  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

Operating System Concepts – 9th Edition 13.15 Silberschatz, Galvin and Gagne ©2013
General Graph Directory

Operating System Concepts – 9th Edition 13.16 Silberschatz, Galvin and Gagne ©2013
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

Operating System Concepts – 9th Edition 13.17 Silberschatz, Galvin and Gagne ©2013
Access Control
 Mode of access: read, write, execute
 Three classes of users on Unix / Linux:
 owner
 group
 public
 With each file and subdirectory we keep 9 protection
bits, 3 for owner, 3 for group, 3 for public.

RWX
a) owner access 7  111
RWX
b) group access 6  110
RWX
c) public access 1  001

Operating System Concepts – 9th Edition 13.18 Silberschatz, Galvin and Gagne ©2013
Access Control (Cont.)
 To create a group, ask the system manager to create a new
group (unique name), say G, and to add some users to the
group (say, Judi, Mark)
 For a particular file (or subdirectory), say game, define an
appropriate access.
 Attach a group, say G, to a file , say game – using the
command “chgrp”

chgrp G game

 Set protection for file “game” -- using the command “chmod”

Operating System Concepts – 9th Edition 13.19 Silberschatz, Galvin and Gagne ©2013
A Sample UNIX Directory Listing
 Example:

 Explanation:
 “into.ps” is a file owned by “pbg” with group ”staff”
 “lib” is a subdirectory owned by “pbg” with group “faculty”

Operating System Concepts – 9th Edition 13.20 Silberschatz, Galvin and Gagne ©2013
End of Chapter 13

Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013

You might also like