CITS2002 Systems Programming  
prev
next CITS2002 CITS2002 schedule  

The Role of Directory Structures

All modern operating systems have adopted the hierarchical directory model to represent collections of files.

A directory itself is typically a special type of file storing information about the files (and hence directories) it contains.

Although a directory is "owned" by a user, the directory is truly owned by the operating system itself. The operating system must constrain access to important, and often hidden, information in the directory itself.

Although the "owner" of a directory may examine and (attempt to) modify it, true modification is only permitted through OS system-calls affecting the internal directory structure.

For example, deleting a file involves both deallocating any disk blocks used by that file, and removing that file's information from its container directory.

If direct modification of the directory were possible, the file may become "unlinked" in the hierarchical structure, and thereafter be inaccessible (as it could not be named and found by name).

In general, each directory is stored as a simple file, containing the names of files within it. The directory's "contents" may be read with simple user-level routines (introduced in Lecture 16).

 


CITS2002 Systems Programming, Lecture 15, p6, 18th September 2023.