Skip to main content

GATE CSE 2021Operating System › I/O, Disk Scheduling & File SystemsVerified

GATE CSE 2021 PYQ: Consider a linear list based directory implementation in a file system. Each directory is a list of nodes,…

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\textsf{foo}.

Which of the following operations will necessarily require a full scan of foo\textsf{foo} for successful completion?

  1. A
    Creation of a new file in foo\textsf{foo}
    Correct answer
  2. B
    Deletion of an existing file from foo\textsf{foo}
  3. C
    Renaming of an existing file in foo\textsf{foo}
    Correct answer
  4. D
    Opening of an existing file in foo\textsf{foo}

Answer

(A, C) Creation of a new file in foo \textsf{foo} foo; Renaming of an existing file in foo \textsf{foo} foo

Approach

In a linear-list directory, file names must be unique within the directory. Operations that must verify uniqueness of a name require checking the entire list, while operations that only need to locate one existing entry can stop once that entry is found.

A linear-list directory has no index or hash table; lookup is sequential. Operations that must guarantee name uniqueness (creation and renaming) can require checking the entire directory, while operations that only locate one existing entry can stop early (deletion and opening). Therefore the required options are A and C.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.