CS FundamentalsHardGATE CS · Product-company placement
A user creates file f, makes a hard link h to it and a symbolic link s to f. Then f is deleted and a NEW file named f is created with different content. What do cat h and cat s print?
- A. cat h prints the old content; cat s prints the new content
- B. Both print the old content
- C. cat h fails; cat s prints the new content
- D. cat h prints the old content; cat s fails
Correct answer: A. cat h prints the old content; cat s prints the new content
h names the original inode, whose link count stayed above zero, so it still holds the old data. s stores only the path "f", which now resolves to the new file. Before f was recreated, cat s would have failed as a dangling link.
More Operating Systems questions
- In the standard five-state process model (new, ready, running, blocked, exit), which transition can NOT happen directly?
- A program uses user-level threads mapped many-to-one onto a single kernel thread. One thread calls a blocking read() on a slow device…
- A bounded-buffer producer is written as wait(mutex); wait(empty); add item; signal(mutex); signal(full); while the consumer is the usual…
- Which statement about Belady's anomaly is correct?
- A machine has 32 GB of physical memory, 4 KB frames and an inverted page table with 8-byte entries. How big is the table, and why is a…
- Which statements are correct? 1. A child that has exited but whose parent has not called wait() is a zombie. 2. A zombie still holds its…