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.

194 File Structures Chapter 6/ (the root directory)/software (a directory)/software/utilities (a directory)/software/utilities/fortran.run (a file)/users (a directory)/users/smith (a directory)/users/smith/mail (a file)/users/smith/thesis (a directory)/users/smith/thesis/simulate.for (a file)/users/smith/thesis/simulate.run (a file)/users/smith/thesis/chapter1.text (a file)/users/smith/courses (a directory)/users/smith/courses/slide1.text (a file)/user/troy (a directory)/user/troy/papers (a directory)/user/troy/papers/JIR.text (a file)/user/troy/papers/smith.text (an indirect file)As before, we have used an initial / to indicate that these are absolute names. Namesrelative to a working directory can be much simpler. We assume that when Mary Smithlogs onto the computer, her working directory is set to /users/smith. At this point,she can name the following files with relative names.mail (a file)thesis (a directory)thesis/simulate.for (a file)thesis/simulate.run (a file)thesis/chapter1.text (a file)courses (a directory)courses/slide1.text (a file)When she wants to work on her thesis, she can change the working directory to thesis(using its relative name) or /users/smith/thesis (using its absolute name).What if she wants to copy her slide1.text file from her courses directory to herthesis directory? She could submit a command of the following form.COPY /users/smith/courses/slide1.textTO /users/smith/thesis/slide1.textBy setting the working directory to /users/smith, she could reduce this command tothe following.COPY courses/slide1.textTO thesis/slide1.textAliases can also reduce the burden of long names. Files that are heavily used mayhave aliases in several directories, so local names usually suffice. Likewise, indirect filesmay specify shared files without worrying about accidentally retaining a copy after theyare deleted.Let us imagine that the command interpreter has an interactive LIST command thatlists the files in any directory. By grouping related files, the file structure makes such acommand both useful and efficient. Directories seldom grow to hold more than about 20or so files. After that point, the user is likely to partition the files into several subdirectories.How would we list the contents of the working directory? We could tell the LISTcommand the absolute name of the working directory, but absolute names are clumsy.We could tell LIST the relative name for the working directory, but we have no suchname. We could let LIST assume that if we give it no argument at all, the working

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

Saved successfully!

Ooh no, something went wrong!