Vitally ?mportant Operating system question Consider a disk where there are a to
ID: 3772325 • Letter: V
Question
Vitally ?mportant Operating system question
Consider a disk where there are a total of 16 blocks in the file system (with indexes 0... 15). Currently the disk contains only two files, which are named f1, and f2. Disk blocks 0, 1, 3, 5, 13 are allocated to f1, and disk blocks 2, 6, 7, 8,11,12 are allocated to f2. The disk block numbers 4, 5, 9, 10,14, 15 appear in the list of free blocks. Assume that the disk block numbers are stored in the i-nodes of the files Explain what the problem is for this file system and how it can be solved.Explanation / Answer
When a file is created on disk, first, kernel creates an i-node for the file and stores the file status in i-node. Then the kernel also allocates data blocks for the file and also updates these data block addresses in the corresponding i-node.
In the given example, there are 16 blocks(0,1,2,3,…,14,15) in the file system.
The file system allocates disk blocks 0,1,3,5,13 to file f1
And allocates disk blocks 2,6,7,8,11,12 to file f2
Thus the actual free disk blocks are 4,9,10,14,15.
But the file system also shows disk block 5 as free.
Thus, there is a possibility to allocate disk block for next file. Hence, the data in the disk block that belongs to file f1 may lose.
To solve this problem, the free list is updated after the data blocks are allocated to a file and updated them in i-node.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.