---
title: "File attributes; levels of directories"
subject: "Operating System"
chapter: 5
key: "semester_6/operating_system:file-attributes-directory-levels"
source: https://www.bctengineer.com/q/semester_6/operating_system/file-attributes-directory-levels
site: BCT Engineering
---

# File attributes; levels of directories

Operating System · Chapter 5: File Systems

- Asked in: year not given
- Video: [07. Directory Hierarchy, File Attributes - FILESYSTEM](https://www.youtube.com/watch?v=8eZJgKk_qEQ) — Dr.Anusha PAPASANI
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/file-attributes-directory-levels
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-5

## Question

What are file attributes? Explain about 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.

## Answer

#### 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.
```text
 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).
```text
 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.
```text
            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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the main benefit of a two-level directory over single-level?
   A. Users can group files into sub-directories
   B. Different users can use the same file names, since each has a private UFD
   C. Sharing is easy
   D. It allows cycles
   Answer: B. The MFD lists users, each with its own UFD; but grouping and sharing remain hard. (Key point: Two-level directory)

2. Which is a problem of the single-level directory?
   A. Cycles cause dangling pointers
   B. Needs path names like /user1/a
   C. All names must be unique and there is no grouping or privacy
   D. Users cannot have files
   Answer: C. One directory for everyone causes name clashes. (Key point: Single-level problem)

3. What does the hierarchical directory add?
   A. Cycles with garbage collection
   B. One shared directory for all
   C. Only two levels
   D. Sub-directories to any depth, giving grouping, absolute/relative paths and a current directory
   Answer: D. Tree structure allows grouping and path names. (Key point: Hierarchical directory)

4. What extra care does an acyclic-graph directory need?
   A. Avoiding dangling pointers when shared files are deleted
   B. Garbage collection for cycles
   C. Unique names across all users
   D. Nothing, links are risk free
   Answer: A. Links allow sharing but a deleted target leaves dangling links; general graphs additionally allow cycles. (Key point: Acyclic vs general graph)

## Related in Operating System

- [File and attributes; allocation methods](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afile-attributes-allocation-methods) — Operating System, chapter 5
- [File attributes; directory systems; free blocks](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afile-attribute-directory-free-blocks) — Operating System, chapter 5
- [File attributes; FS implementation ways](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Afile-attribute-implementation-best) — Operating System, chapter 5
