CS FundamentalsVery hardGATE CS

A directory has 3 entries named a, b and c that are hard links to the same inode, and the directory itself has 2 subdirectories. What are the link counts of the shared inode and of the directory (classic Unix, counting '.' and '..')?

  1. A. 3 and 4
  2. B. 1 and 2
  3. C. 3 and 2
  4. D. 1 and 4

Correct answer: A. 3 and 4

Each hard link adds one to the file's count: 3. A directory's count is 2 (its entry in the parent plus its own '.') plus one for each subdirectory's '..': 2 + 2 = 4.

More Operating Systems questions

Exams that ask this topic