G53OPS - Operating Systems

This course is run at the The University of Nottingham within the School of Computer Science & IT. The course is run by Graham Kendall (EMAIL : gxk@cs.nott.ac.uk)


File System Implementation

This section is based on (Tanenbaum, 1992), pages 162-168.

In this and subsequent sections we look at various ways in which filing systems can be implemented. In particular, we will look at how files and directories are stored, how disc space is managed and how we can make the filing system efficient and reliable.

Implementing a file system can be reduced to keeping track of which block is associated with which file. Below we look at some methods.

Contiguous Allocation

One implementation is to allocate n contiguous blocks to a file. If a file was 100K in size and the block was 1K then 100 contiguous blocks would be required. This method has two advantages.

1. It is simple to implement as keeping track of the blocks allocated to a file is reduced to storing the first block that the file occupies and its length, which is likely to be stored as one of its attributes anyway.
2. The performance of such an implementation is good as the file can be read as a contiguous file. The read write heads have to move very little, if at all. You will never find a filing system that performs as well.

But, this method also has two significant drawbacks.

· The operating system does not know, in advance, how much space the file can occupy. If the file is sized at 100K and later grows (or tries to) to 150K there may not be enough contiguous space to meet the new file size. Of course, more space than is initially requested could be reserved but this is not only wasteful, but still does not guarantee that the space allocated will not be exceeded.
· This method leads to fragmentation. As files are created and deleted holes will be left which may not be big enough to place a file. A defragmentation process could be run periodically but this is wasteful of CPU resources and takes a long time.

Last Page Back to Main Index Next Page


 


 Last Updated : 23/01/2002