<< Chapter < Page | Chapter >> Page > |
Even if it is possible to allocate in groups, how do you know when to do it? Be guided by history: if file is already big, it willprobably get bigger.
Computers can crash at any time, and we want the file system to behave sensibly in the face of crashes. The key idea is calledconsistency:
Insuring consistency requires two things:
There are three basic updates that happen when data is written to a file.
These operations must be done in the above order. If they are not, then it is possible to have a data block included in a file thatmight have garbage (uninitialized data) in the block.
After rebooting, the recovery utility program on Unix, called "fsck", is going to traverse the entire directory structure of thedisk to insure that all free blocks are in the free list.
Recovery after a crash follows these steps:
At the completion of the algorithm, you can compare the actual bit map to the temporary one to find blocks that were allocated, butnever made it into a file.
Users need a way of finding the files that they created on disk. One approach is just to have users remember descriptor indexes.
Of course, users want to use text names to refer to files. Special disk structures called directories are used to tell whatdescriptor indices correspond to what names.
A hard concept to understand at the beginning: naming is one of the (if not the) most important issues in systems design.
Approach #1: have a single directory for the whole disk. Use a special area of disk to hold the directory.
Approach #2: have a separate directory for each user (TOPS-10 approach). This is still clumsy: names from different projects getconfused.
Notification Switch
Would you like to follow the 'Operating systems' conversation and receive update notifications?