operating-systems file-management

Definition

File Directory

A directory (or folder) is a special system file containing mappings that translate user-defined file names into references to physical data.

Structure

Flat List

A single list of entries for the entire partition. Found in early or simple operating systems.

Hierarchical Tree

Nested structure where directories contain files and sub-directories. Standard for modern operating systems.

Pathnames

Absolute Pathname

Specifies location from the root directory (e.g., /home/user/notes.txt in Unix, C:\Users\User\notes.txt in Windows).

Relative Pathname

Locates a file relative to the Current Working Directory (CWD).

  • . refers to the current directory
  • .. refers to the parent directory

Implementation

Attributes in Directory

Directory entry contains file name, all attributes, and physical address (e.g., early Windows/MS-DOS).

Long filenames in Windows 95/98 use “extension” entries marked with attribute byte 0x0F.

Attributes in i-nodes

Directory entry contains only file name and i-node number. Attributes and block pointers stored in the i-node (Unix/Linux standard).

Operations

OperationDescription
create / deleteCreate or remove a directory
opendir / closedirOpen or close a directory stream
readdirRead the next entry
renameChange directory name
link / unlinkManage hard links to files