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

Here I know that the creation of a new file necessarily required a full scan. But I'm confused with how the renaming of the file necessarily requires a full scan. Please, explain how the renaming is done in the directory structure.

  • $\begingroup$ What if you rename it to an existing name? $\endgroup$ – PassingStranger Apr 8 at 1:59
  • 1
    $\begingroup$ Try to write out an algorithm for renaming a file. $\endgroup$ – Yuval Filmus Apr 8 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.