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 System Software and Operating System questions
- A system has 12 instances of a resource R shared among four processes. The maximum need and current allocation of each process are: Process…
- Given 4 GB (≈ 4.3 × 10⁹ bytes) of virtual address space and a page size of 4 KB (= 4 × 10³ bytes), with each page table entry 5 bytes: how…
- A table T with 17 rows and 1024 columns is stored in memory. T[i][j] and the variable temp are 32-bit floating-point values; memory is word…
- Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same colum…
- Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same colum…
- Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same colum…