CS FundamentalsHardGATE CS
After fork(), a parent and child both write to a file descriptor that was opened before the fork, without O_APPEND. Why do their writes not overwrite each other?
- A. The kernel gives the child a copy of the file
- B. Both descriptors refer to the same open-file description, so they share one file offset that each write advances
- C. Each process gets its own offset starting at 0
- D. Writes from children are buffered until the parent exits
Correct answer: B. Both descriptors refer to the same open-file description, so they share one file offset that each write advances
fork duplicates descriptors like dup(): they share the open-file description and its offset, so sequential writes advance the same position (interleaving is still possible).
More Operating Systems questions
- Which statement about access-control lists (ACLs) versus capability lists is correct?
- A setuid-root program calls access(path, ROK) to check the real user may read path, then calls open(path). Which vulnerability does this…
- Which defence makes a stack-buffer-overflow attack that jumps to injected shellcode on the stack fail, even if the return address is…
- In the Bell–LaPadula confidentiality model, which rules apply?
- Which component of a computer can a hypervisor of TYPE 1 run on directly?
- Why could a classic x86 CPU (before VT-x/AMD-V) not be virtualised by pure trap-and-emulate?