Page 236 - DCAP103_Principle of operating system
P. 236
Unit 6: File Management
Notes
Figure 6.13: (a) Attributes in the Directory Entry and (b) Attributes Elsewhere
When a file is opened, the operating system searches its directory until it finds the name of
the file to be opened. It then extracts the attributes and disk addresses, either directly from the
directory entry or from the data structure pointed to, and puts them in a table in main memory.
All subsequent references to the file use the information in main memory.
The number of directories varies from system to system. The simplest form of directory
system is a single directory containing all files for all users, as illustrated in Fig. 6.14(a). On
early personal computers, this single-directory system was common, in part because there
was only one user.
Figure 6.14: Three File System Designs: (a) Single Directory Shared by All Users,
(b) One Directory Per User, (c) Arbitrary Tree Per User. The Letters Indicate the
Directory or File’s Owner
The problem with having only one directory in a system with multiple users is that different users
may accidentally use the same names for their files. For example, if user A creates a file called
mailbox, and then later user B also creates a file called mailbox, B’s file will overwrite A’s file.
Consequently, this scheme is not used on multi-user systems any more, but could be used on a
small embedded system, for example, a handheld personal digital assistant or a cellular telephone.
To avoid conflicts caused by different users choosing the same file name for their own files,
the next step up is giving each user a private directory. In that way, names chosen by one user
do not interfere with names chosen by a different user and there is no problem caused by the
same name occurring in two or more directories. This design leads to the system of Fig. 6.14 (b).
LOVELY PROFESSIONAL UNIVERSITY 229