- Year not given
File attributes; levels of directories
Short answer
File attributes are metadata such as name, identifier, type, location, size, protection, and timestamps. Directory levels include single-level (name conflicts), two-level (per-user directory but no user grouping), tree-structured (hierarchical, grouping, absolute/relative paths, per-directory protection), acyclic-graph with links for sharing, and general graph allowing cycles.
What are file attributes? Explain about levels of directories.
File attributes
A file is a named collection of related information stored on secondary storage; it is the logical unit of storage seen by the user (programs, documents, data). Files have an internal structure (byte stream, records, tree) and a type (regular, directory, special).
File attributes (metadata) maintained for each file:
| Attribute | Meaning |
|---|---|
| Name | Human-readable identifier |
| Identifier | Unique tag (i-node number) used by the system |
| Type | Text, executable, directory, etc. |
| Location | Pointer to the device and disk blocks |
| Size | Current size in bytes/blocks |
| Protection | Permissions: read, write, execute for owner, group, others |
| Time, date, user ID | Creation, last access and modification, owner |
| Flags | Read-only, hidden, system, archive, lock flags |
Levels of directories
A directory is a file containing the entries of other files. Directory structures:
1. Single-level directory: one directory for all users' files.
root --> [ a ][ b ][ c ][ d ] ...
Simple, but every file name must be unique, no grouping, slow search when many files, and no privacy among users.
2. Two-level directory: a master file directory (MFD) lists the users; each user has a private user file directory (UFD).
MFD --> user1 --> [a][b]
--> user2 --> [a][c]
Different users may use the same file names, and search is efficient; but users cannot group their own files and sharing is difficult (needs path names like /user1/a).
3. Hierarchical (tree-structured) directory: directories can contain files and sub-directories to any depth, with a root.
root
/ | \
bin usr home
| |
local ram
/ \
docs src
Supports grouping, absolute and relative path names, a current working directory, and per-directory protection. This is used in UNIX and Windows.
4. Acyclic-graph directory: allows sharing of files and sub-directories through links (hard/symbolic), but needs care to avoid dangling pointers and cycles.
5. General graph directory: allows cycles, which need garbage collection or cycle checks.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- File and attributes; allocation methods · Operating System, chapter 5
- File attributes; directory systems; free blocks · Operating System, chapter 5
- File attributes; FS implementation ways · Operating System, chapter 5