In Unix operating system, when a process creates a new process using the fork…
2016
In Unix operating system, when a process creates a new process using the fork () system call, which of the following state is shared between the parent process and child process ?
- A.
Heap
- B.
Stack
- C.
Shared memory segments
- D.
Both Heap and Stack
Attempted by 527 students.
Show answer & explanation
Correct answer: C
Correct answer: Shared memory segments
Explanation:
Heap and stack are not shared: they are duplicated for the child process. Modern Unix-like systems use copy-on-write, so the physical memory is only copied if one process modifies it, but logically each process has its own heap and stack.
Shared memory segments remain shared: memory regions created using System V shared memory or mmap with MAP_SHARED are mapped into both processes and refer to the same physical memory.
Other resources that are shared after fork() include open file descriptors (they refer to the same file description and share file offsets) and certain kernel-level resources; process identifiers and address spaces remain distinct.