Homework_9 Version 0 |
|
👤 Author: by typeme3163com 2019-12-04 14:33:02 |
There are three different allocation methods for disk space. Those are Contiguous Allocation, Linked Allocation and Indexed Allocation.
The continuous allocation method requires each file to occupy a set of continuous addresses on the disk. The disk address defines the linear order on the disk. When a file must be stored on disk, the system will search a set of adjacent blocks based on the file size, that is, the system will wait until the required number of memory blocks are found in order. When there is free space, the system stores the files on disk and creates an entry in the directory.
There are two advantages. First, Continuous allocation supports sequential and direct access.And, the minimum number of disk lookups is required to access continuously allocated files.
There are two disadvantages. First, it is hard to find a free space for a new file, which is also called a dynamic storage-allocation problem. Dynamic storage allocation problem, which involves how to meet the size of N request in a free hole list. How to select a free hole from a set of available holes. Another problem is to determine the space of new files. We don't know the size of previous files. This can waste a lot of memory.
In linked allocation, each file is a linked list of disk blocks. The directory contains a pointer to the first and optionally the last block of the file. For example, a file of 5 blocks which starts at block 4, might continue at block 7, then block 16, block 10, and finally block 27. Each block contains a pointer to the next block and the last block contains a NIL pointer. The value -1 may be used for NIL to differentiate it from block 0.
The advantage is that this is a very flexible file size. File size can be easily increased because the system does not have to look for contiguous blocks of memory.
The disadvantage is that it only supports sequence access. Another problem is that pointers can take up some memory. The third problem is that the implementation of this method is very low, because the pointer may be lost.
Linked allocation does not support random access of files, since each block can only be found from the previous. Indexed allocation solves this problem by bringing all the pointers together into an index block. One disk block is just used to store DBAs (disk block addresses) of a file.
The advantage is It overcomes the problem of external fragmentation.
The disadvantage is pointer cost of index allocation is greater than link allocation.
Please login to reply. Login