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.

Exercises 23316. If we use the ruler-function method of saving files, what is the average length oftime a file is saved after it is deleted?17. What criteria are important in evaluating a file-dump schedule?18. Assume that we use the ruler-function method of saving files. A file is created onday c and deleted on day d . It is now day n . Give a formula or algorithm for finding thetape that holds the most recent copy of this file.19. In most versions of Unix, the file manager does not try to prevent simultaneousaccess to a shared file. Show how co-operating programs could still avoid simultaneousaccess. (Hint: Use an auxiliary empty file.) What happens if a process terminates unexpectedly?20. The text suggests that free blocks may be arranged as a tree with a large fan-out.What advantage does this structure have over arranging free space as a singly linked list,which is a tree with a very small fan-out?21. Why should we use cylinder and track maps for allocation of files whose length weknow beforehand? Wouldn’t a linked list or a tree of free blocks be better?22. When a tree of free blocks is used, each time a free block becomes allocated, itscontents must be saved, or else pointers to other free blocks are lost. The amount ofsaved information can grow very large. Suggest a structure intermediate between a largefan-out tree and a linked list that makes this problem disappear.23. Should overflow file descriptors be placed in a well-known region of the disk forthe scavenger to find?24. Assume that I have a file that has 50 million bytes. How many 512-byte blocksdoes it take to store the data? How many blocks of file descriptor or overflow filedescriptor are needed, under the following three assumptions?(a) We use a linear chain of overflow descriptors.(b) We use a tree of overflow descriptors of the appropriate depth.(c) We have seven direct pointers, one indirect pointer, one doubly indirect pointer, andone triply indirect pointer in the file descriptor.25. You are designing disk structures for files with versions. Two versions are identicalexcept that the later version has an extra byte near the beginning. What structure isappropriate if you want to share blocks between these two versions? Comment onwhether you think this structure is worth the effort.26. Proper treatment of locks can be summed up as follows: Each file must be lockedbefore it is accessed, and it should not be unlocked until the transaction has finished allaccesses to that file. Why is the second clause important? Isn’t it enough to make surethe file is locked during each access?27. Why is copy on write especially appropriate for implementing file versions whenthe file manager supports mapped access?28. If we implement copy on write, what extra data must be stored in the file descriptorsand data blocks of files in order to avoid unnecessary splitting and to postponereclaiming a disk block until all the versions that use it have been deleted?

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

Saved successfully!

Ooh no, something went wrong!