13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Naming structure of files 189SetWorkingDirectory(new directory). This call sets the working directory forthe process to the new directory (if it exists). There could be a special value for‘‘new directory’’ that means the user’s own directory.When Mary logs on (interactively) or starts a job (in batch), the processes that work onher behalf will use smith.thesis as their working directory.A two-level scheme is useful even if there is only one user. It is found on manycomputers to indicate which disk drive or which other device holds a file, even if a flatstructure is used within devices. For example, a personal computer that has both a harddisk and a floppy disk might have a command like the following:COPY /HardDisk/project.mod TO /Floppy/save1.modThe name of the device acts as a directory. When the working directory is set to Hard-Disk, relative names suffice for files stored on the hard disk, but files on the floppy needabsolute names.1.3 Aliases and indirect filesTwo different directories may need to share a file that doesn’t belong naturally to eitherone exclusively. For example, Mary Smith may wish to access her computer-mail filewhether she is using account smith.thesis or smith.coursework. She wouldprefer to avoid placing the mail file in one directory or the other because that would forceher to use a full name on some occasions. The Multics and Unix operating systems allowthe very same file to be present in several directories. We will say that the file hasseveral aliases. To build an alias for a file, a process may use the following service call:Alias(old name, new name). This call builds a new directory entry that refers tothe same file as the old name. Both names may be absolute or relative. Relativenames are understood with respect to the working directory. The call fails if theold file does not exist or the new name cannot be used (the new name is already inuse, the caller does not have necessary permissions, or the physical implementationof files cannot arrange for the alias).Aliases for the same file are not independent copies. There is only one file, and if it ismodified under any alias, the file under other aliases is likewise changed.Figure 6.2 shows the same files as before, but now Mary Smith has two accounts,one for her coursework and another for her thesis. She has placed an alias for her mailfile in both accounts to make it easy to access. Helen Troy’s account is also shown, as isa software directory for such programs as the Fortran compiler. The dashed lines indicatean indirect file, which we will describe shortly. If the working directory issmith.courses, the following files are accessible:

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

Saved successfully!

Ooh no, something went wrong!