Skip to main content

File attributes; directory systems; free blocks

Short answer

A file attribute is metadata (name, size, owner, permissions, timestamps). Single-level directory forces unique names for all files; hierarchical allows directories and subdirectories, enabling grouping and pathnames. Free blocks are managed by bitmap, linked list, grouping, counting, or free-list blocks.

What is File Attribute? Write the difference between Single level directory system and Hierarchical directory system. Explain how operating system manages free blocks of Secondary storage.

File attribute

A file attribute is a piece of metadata about a file, such as its name, type, size, location, owner, permissions and time stamps (creation, modification, last access).

Single-level vs hierarchical directory

PointSingle-level directoryHierarchical (tree) directory
StructureOne directory holds all files of all usersDirectories contain files and sub-directories, forming a tree
NamingAll names must be uniqueSame name allowed in different directories
GroupingNot possibleFiles can be grouped logically (by user/project)
SearchingSlow for many filesFaster; search along a path
Path namesJust a file nameAbsolute or relative path (/home/ram/a.c)
Multi-userPoor, name clashes, no privacyGood, per-user directories and protection
ExampleEarly systems (CP/M)UNIX, Windows
 single:  [ a  b  c  d  e ... ]         tree:     root
                                               /      \
                                             usr      home
                                              |      /    \
                                             bin   ram    sita

Management of free blocks

The OS keeps track of free disk blocks by:

  • Bit map: one bit per block (1 = free). Example: 0011010011... shows blocks 2, 3, 5, 8, 9 free. Easy to find contiguous blocks; a 16 GB disk with 1 KB blocks needs 2 MB.
  • Linked list: each free block holds the number of the next free block; the head is kept by the OS. No extra space but slow.
  • Grouping: the first free block holds n free block addresses, the last of which points to another such block.
  • Counting: store (first free block, count of consecutive free blocks), e.g. (2,2), (5,1), (8,2).
  • Free-list blocks: a block stores many free block numbers (e.g. 255 per 1 KB block) and is read when needed.

The chosen block is removed from the structure on allocation and added again on deletion.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 5 questions →