On 7/18/07, yogesh tillu <yogesh_tillu2003 at yahoo.co.in> wrote:
> Yeah, thats right. The buffer is filled but not flushed. After the
> fork, the entire address space (and hence the buffer) gets replicated
> * But I think currently copy on write approach is used for the
> *implementation of the fork .So entire address space will not get
> *replicated {previously clone approach was used , so in that *whole
> address space gets replicated }
> *
Copy-on-write (COW) is a method of replication of address spaces. Its
a bit hard to explain on mail, but the basic concept is this -
It is not necessary to actually copy the pages in memory until the
data in the two processes becomes different. Till then the OS
maintains page tables such that the same page is used until one of the
processes modifies the contents of that page. When that happens, the
page is first copied and then written. Obviously, it is no longer
shared after that.
So it doesnt matter whether whether the OS uses COW or not. When seen
from userland, the address space is replicated.
Hope that answers your question. For details, refer to some book on OS theory.
-aditya