[Chapter 3 Process]Practice 3.5 When a process creates a new process using the fork() operation

时间:2023-11-28 13:55:44

3.5 When a process creates a new process using the fork() operation, which of the following state is shared between the parent process and the child process?

  a. Stack  b.Heap  c.Shared memory segments

答案:c.Shared memory segments.

解析:fork一个新的子进程时, 子进程会得到和父进程用户级虚拟地址空间相同的一份拷贝, 包括文本, 数据和bss段, 堆以及用户栈。 所以他们只有shared memory segments 会在他们之间共享。