Practice mode Operating Systems

After fork() on Linux, how are the parent’s memory pages normally handled?

Correct answer A. They are shared copy-on-write, so a page is copied only when either process writes to it

Explanation

Linux implements fork() with copy-on-write: parent and child share the same physical pages marked read-only, and a private copy is made only when one of them writes. Since many children call exec soon after fork, this avoids copying memory that would be thrown away. The only real cost of fork() is duplicating page tables and creating the task structure.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.