Professional Documents
Culture Documents
Class 4.4
Class 4.4
Directory
Files
F1 F2 F4
F3
Fn
• Naming problem
Two-Level Directory
• Separate directory for each user
When a user job starts or a user logs in, the system’s master file
directory (MFD) is searched.
The MFD is indexed by user name or account number, and each
entry points to the UFD for that user.
Path name
Can have the same file name for different user
Efficient searching
Tree-Structured Directories
One bit in each directory entry defines the entry as a file (0) or as a
subdirectory (1)
Special system calls are used to create and delete directories
When reference is made to a file, the current directory is
searched
If a file is needed that is not in the current directory, then the
user usually must either
specify a path name or
change the current directory to be the directory holding that
file
To change directories, a system call is provided that takes a
directory name as a parameter and uses it to redefine the
current directory.
Path names can be of two types: absolute and relative
Absolute- begins at the root and follows a path down to the
specified file, giving the directory names on the path
Relative- defines a path from the current directory
Assume current directory is root/spell/mail
Tree-Structured 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