Q Write short note on directory structure ? --- 4 m
Ans : Directory is a data structure for storing details about files. A directory typically contains a number of records, one per file. Each record contains.
1) File Name 2) File Attributes 3) Address of disk block
Types of directory structure
a) Flat Directory In case of flat directory, all files are contained in the root directory and there is no other subdirectory.
b) Hierarchical directory In case of hierarchical directory, the directory is organized as a tree data structure. There is a root directory, which has under it a number of subdirectories and files. Each subdirectory, in turn may have subdirectories and files as entries. Two approaches are commonly used to specify a file in
1) Absolute path name In this method, each file is given and absolute pathname consisting of the path from the root directory to the files. For example the path / D2 / D21 / F2 means that:
i) Root directory contains a subdirectory D2.
ii) The subdirectory D2 contains another subdirectory D21
iii) The subdirectory D21 contains the file F2. Absolute pathname always starts at the root directory and is unique for each file.
2) Relative Pathname Relative pathname is always with respect to working ( current ) directory. User can specify a file with respect to working directory. In almost every operating system, each process has a working directory.