GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 15

GATE CSE 2021 Set 1 Q15

Operating Systems · File Systems · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q15 1 mark · MSQ
Report issue

File Systems

Question 15, GATE 2021: A directory foo is implemented as an unsorted linear list of nodes containing file names and metadata including data-block pointers. Which successful operations necessarily require a full scan? A create a new file; B delete an existing file; C rename an existing file; D open an existing file.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A; C

Our answer: A; C under fresh-name uniqueness checking

Creating a new file requires checking that its proposed name is absent from the entire unsorted directory list. Renaming to a new unused name similarly needs an absence check. Deletion or opening can stop when the existing entry is found, so they do not necessarily scan the entire list. Thus A, C under the intended simple-directory model. A real rename operation that is permitted to replace an existing target, or an indexed name cache, changes the necessity claim; those are outside this linear-list/fresh-name interpretation.

A successful lookup can stop at the matched name, perhaps the first node, so opening/deleting do not necessarily scan all nodes. To establish that a proposed new name is absent, finding no match in only a prefix is insufficient: it could occur in the unvisited suffix. Creation and a rename to a fresh name must therefore inspect the whole directory. The distinction is existential lookup versus proof of absence, not simply whether the operation changes disk contents.

Original paper, page 19 · Answer key