Question

In a system with paged memory, where Copy On Write technique is used, a process creates a new process with fork() call.

Right after creation, the new process tries to write something in the memory. Which error will the CPU generate - page fault or something else?

As far as i know, when copy on write is used, that means that common data is not copied, but when we use fork(), when a new process tries to write in a certain page, that pages stops being shared, and the process created with fork gets a copy of the page so it can write in it.

So, i'm a little confused will the processor generate an error at all?

Was it helpful?

Solution

Page faults are generated by the processor the first time a copy-on-write page is written to, but the fault is handled by the kernel (just like faults on pages that are swapped out or zero-filled). It isn't passed on to userspace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top