double level directory structure 55(1)
TRANSCRIPT
http://raj-os.blogspot.in 1
TWO -LEVEL DIRECTORY
http://raj-os.blogspot.in 2
Fig 2 Two-level directory
http://raj-os.blogspot.in 3
Features
• System maintains a master file directory ( MFD )
• A separate directory for each user
– user file directory ( UFD )
• Each UFD has similar structure
• A UFD lists files of a single user
• MFD contains one entry for each user
• Each entry points to the UFD of that user
• User name and a file name constitute a path name
http://raj-os.blogspot.in 4
Advantages
• Solves the name collision problem
-Different users may have files with same names
• Effective isolation of one user from others
• Efficient searching
http://raj-os.blogspot.in 5
Limitations
Sharing of files by different users is difficult
• User must know path name to access a file in other user’s
directory
• Some systems do not allow sharing of files
http://raj-os.blogspot.in 6
TREE-STRUCTURED DIRECTORY
http://raj-os.blogspot.in 7
• The two-level directory structure can be extended
to a tree of arbitrary height as shown in the figure
in next slide
Tree-structured Directory
http://raj-os.blogspot.in 8
Fig 1 Tree-structured directory
http://raj-os.blogspot.in 9
Tree is the most common directory structure
http://raj-os.blogspot.in 10
Examples of systems supporting tree structure
• MS-DOS
• UNIX
http://raj-os.blogspot.in 11
Features
• A tree has a root directory
• The root contains a set of directories
• A directory contains a set of files and other sub directories
• Each sub directory can further contain a set of files and other
sub directories
• Each file has a unique path name
Tree is the most common directory structure
http://raj-os.blogspot.in 12
Path Name
• A path name is the path from the root, through all
the subdirectories, to a specified file.
Example:
• In Fig. 1 root/spell/mail/prog/obj is a path
Tree is the most common Directory Structure
http://raj-os.blogspot.in 13
Some more points
• A directory is simply another file, but treated in a different way
• All directories have same internal format
• One bit in each directory entry defines the entry as a file(0) or as a
sub directory(1)
• Directories are created and deleted using special system calls
Tree is the most common directory structure
http://raj-os.blogspot.in 14
Current Directory
• Every user is allocated a separate directory
which is the default directory for the user
• When a user first logs into the system the default
directory is immediately made accessible to him
• This default directory is called the current directory
Tree is the most common directory structure
http://raj-os.blogspot.in 15
Current Directory
• The current directory should contain most of the files
that are of current interest to the user
• When reference is made to a file, the current
directory is searched
Tree is the most common directory structure
http://raj-os.blogspot.in 16
Current Directory
If a file is needed that is not in the current directory,
then
• The user must either specify a path name
or
• change the current directory to be the
directory holding that file
Tree is the most common directory structure
http://raj-os.blogspot.in 17
Current Directory
To change the current directory to a different directory
• A system call is provided
• The new directory name acts as parameter to the
system call which uses it to redefine the current
directory
Tree is the most common directory structure
http://raj-os.blogspot.in 18
Types of path names
Can be of two types
• Absolute path name
• Relative path name
http://raj-os.blogspot.in 19
Absolute Path Name
• An absolute path name begins at the root and follows a
path down to the specified file giving the directory
names on the path
http://raj-os.blogspot.in 20
Relative Path Name
• A relative path name defines a path from the current
directory
http://raj-os.blogspot.in 21
Example
• With ref. To fig. 1, if the current directory is root/spell/mail, to reference the file list
relative path name : prog/list
absolute path name : root/spell/mail/prog/list
http://raj-os.blogspot.in 22
Summary
In this class, you have learnt:• Single level directory structure
• Two level directory structure• Tree structure directory
http://raj-os.blogspot.in 23
Frequently Asked Questions
1. Explain single level directory structure. State its
advantages and limitations
2. Explain two level directory structure. State its
advantages and disadvantages
3. Explain tree directory structure. State its advantages and
disadvantages
http://raj-os.blogspot.in 24
Quiz
http://raj-os.blogspot.in 25
1. Which of the following is not true about a single level directory
a) Duplicate file names allowed
b) Simple structure
c) Easy to maintain and support
d) File names must be unique
http://raj-os.blogspot.in 26
2. What is an MFD ?
a) Minimum File Density
b) Master File Directory
c) Maximum File Density
d) Master File Data
http://raj-os.blogspot.in 27
3. What is the relation between MFD and UFD?
a) No relation
b) Both are one and the same
c) MFD contains pointers to UFD’s
d) None of the above
http://raj-os.blogspot.in 28
4. In a tree structured directory, the leaf nodes are always
a) Files
b) Subdirectories
c) Either files or subdirectories
d) None of the above
http://raj-os.blogspot.in 29
5. The relative path name is
a) A system call
b) The path from current position to the specified file
c) The path from root to the specified file
d) None of the above
http://raj-os.blogspot.in 30
6. An absolute path name starts
a) At current position
b) Some times at current position and sometimes at root
c) Always at root
d) None of the above
http://raj-os.blogspot.in 31
State whether the following are true or false
http://raj-os.blogspot.in 32
State true or false
A system can have any no of MFD’s
False
http://raj-os.blogspot.in 33
State true or false
There is only one UFD in a system
False
http://raj-os.blogspot.in 34
State true or false
There is no isolation of users in a single level directory
True
http://raj-os.blogspot.in 35
State true or false
Name collision problem is solved in two level directories
True
http://raj-os.blogspot.in 36
State true or false
A directory is also a file
True
http://raj-os.blogspot.in 37
State true or false
In tree-structured directories, the height ofthe tree is restricted to 2
False
http://raj-os.blogspot.in 38
State true or false
The relative path name is easier to specify than the absolute path
True
http://raj-os.blogspot.in 39
State true or false
The current directory of a user can never be changedFalse