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.

232 File Structures Chapter 61. Implement a file system by using a normal file of length 10K bytes as a virtualdisk. Your program should be built in several layers: Directory control: creates and deletes files and directories File transput: opens, closes, reads, writes, positions, and searches directories Buffered transput: Caches recently-used blocks Basic transput: Reads and writes one block.For simplicity, you can make these assumptions: (a) There is only one user. (b) Thereare no aliases, either direct or indirect. (c) There is no file protection. (d) Time stampsare not needed in the file descriptor. (e) A file only has one version. To make the probleminteresting, do implement hierarchical directories and direct access.2. John makes a file called JFile. Deborah makes an alias for JFile, calledDFile. John deletes JFile. Then John creates a new file, also called JFile. Howmany different files are there at the end of this scenario? Would the answer be differentif Deborah had made an indirect file called DFile that pointed to JFile?3. Distinguish between an alias and an indirect file.4. Does it make sense to make an indirect file that points to a non-existent file?5. What is the difference between a local file name and a relative file name?6. Give five different full path names for the slide1.text file in the example inthe text. There are no aliases in the example. (Hint: Use % and ˆ.)7. Assume that we allow introducing aliased names for directories. What problemscan occur?8. The text mentions default permissions for files and suggests both a ‘‘positive’’default (permissions that all files automatically receive) and a ‘‘negative’’ default (permissionsthat all files automatically do not receive). Compare how well these twomethods work for building executable files.9. Give one good reason to prevent file owners from automatically having theSetOwner privilege over their files.10. Suggest a reason why someone might want to build a directory over which othershave Execute but not Read privilege.11. We treat a relative file name in an indirect file as relative to the directory in whichthe indirect file resides. What would be wrong with treating it as relative to the workingdirectory instead?12. What does it mean to delete a directory that still has files in it?13. What does it mean to delete a directory that is the working directory for some process?14. Show a simple way to build a cycle of indirect files.15. Why do indirect files have a problem of cycles but aliases do not? (Assume thatboth indirect files and aliases apply only to ordinary files, not to directories.)

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

Saved successfully!

Ooh no, something went wrong!