Copy-on-write
The fork() system call creates a child
process that is a duplicate of its parent. Traditionally fork() creates a copy
of the parent’s address space for the child, duplicating the pages belonging to
the parent.
Instead of copying the parent’s address
space a technique known as Copy-on-write is used. It works by allowing the
parent and child process initially shares the same pages. These shared pages are
marked as copy-on-write pages, meaning that if either process writes to a shared
page, a copy of the shared page is created.
Obviously only pages that can be
modified even need to be labeled as copy-on-write. Code segments can simply be
shared. Pages used to satisfy copy-on-write duplication are typically
allocated using zero-fill-on-demand, meaning that their
previous contents are zeroed out before the copy proceeds.
No comments:
Post a Comment