All mock tests are FREE till 31 December — register to save your progress

In the UNIX operating system, when a process creates a child process using the fork() system call, which of the following is genuinely shared between the parent and child process, rather than being copied?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. Shared memory segments

Explanation

fork() gives the child a logical duplicate of the parent's address space: the heap and stack are process-private, implemented with copy-on-write so each process ends up with its own independent pages the moment either one writes to them — they are copied, not shared. Any System V/POSIX shared-memory segment the parent had attached (e.g. via shmat() or mmap(MAP_SHARED)), however, continues to map onto the exact same physical memory in both processes after the fork, so writes by either process are immediately visible to the other. Hence it is the shared memory segments that are truly shared, option (iii), while heap and stack remain independent in each process.

More Computer System Architecture questions