13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

192 File Structures Chapter 6Figure 6.2 shows an indirect file, /troy/smith.text, which refers to the file/smith.thesis/chapter1.text. <strong>An</strong>y attempt to open the indirect file will resultin opening the other one instead. (Relative names in an indirect file may be understoodwith respect to the working directory of the process or with respect to the directory wherethe indirect file is stored. Unix chooses the second alternative.) A chain of indirect filesis meaningful, but to prevent getting lost in cycles, the file manager should refuse toaccept a chain longer than five or so indirect files.Indirect files raise the same issues of deletion and accounting as aliases.Deletion: Deleting an indirect file A has no effect on the file B it refers to. Deletinga file B referred to by an indirect file A makes A useless. It is then impossibleto open A, but A still remains in its directory. If a file named B is later created, Ais again usable.Accounting: If an indirect file A refers to B, the owner of A should pay for the(minuscule) amount of disk storage A occupies. The owner of B should pay for allof B. The owner of B can always avoid payment by deleting the file; this actionrenders the indirect file A worthless. If the owner of A wants to be sure that Bcan’t be deleted, that owner should have to pay for part of B by making a regularalias.Aliases and indirect files form interconnections by means of entries in directorystructures. VMS provides logical names through data structures in the file manager toserve a similar purpose. Whenever a relative file name is presented to the file manager, itchecks the first part of the name against several translation tables. The global tableapplies to all processes, the group table applies to all processes within a group, and eachprocess has two private tables, one of which is inherited by its children. System calls areavailable to manipulate these tables; modifying the first two requires special privilege.Each table entry gives a logical name and its translation. The same logical name may betranslated differently by different tables, and one name may have several translations inthe same table. Each of these translations is tried in a standard order (recursively, sincethe translation may itself be a logical name) until a name that corresponds to an actualfile is found. Logical names can be used to point to directories where standard softwareis kept. A user can then refer to software/editor.run, for example, withoutneeding to know where the software directory is. People testing new versions can makea group logical name for software that points to a different directory.We could have introduced aliases and indirect files when we were discussing flatdirectory structures, but they are much more important when full names become cumbersome,as they are with two levels. The extension from two levels to an arbitrary numberof levels is the next step.1.4 Hierarchical directoriesIt is not hard to generalize the two-level directory structure into an arbitrary number oflayers. We started in that direction when we gave Mary Smith two different accounts,one for her thesis work and one for her course work. It would have been more helpful to

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!