GATE | GATE CS 2021 | Set 1 | Question 25
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo.
Which of the following operations will necessarily require a full scan of foo for successful completion?
(A) Creation of a new file in foo
(B) Deletion of an existing file from foo
(C) Renaming of an existing file in foo
(D) Opening of an existing file in foo
Answer: (A) (C)
Explanation: Since a directory contains a list of nodes, where each node contains the file name along with the file a metadata, such as the list of pointers to the data blocks,
We necessarily have to full scan of foo to rename of an existing file and repeating file names are not allowed in a directory so, to create a new file, first we have to check whether it already exists or not, and it requires a full complete scan.
Quiz of this Question
Last Updated :
24 May, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...