Re: copy-on-write

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Fri, 2 May 1997 14:46:05 +0200 (EET)

> Hi
>
> Looking at
> http://squid.nlanr.net/Squid/Devel/todo.html
> http://squid.nlanr.net/Squid/Devel/Todo/9703122.txt
>
> I don't think that this is necessary (at least with linux, probably with
> newer versions of solaris too, from what I have heard)
>
> Most use a "Copy-On-Write" method when they fork. This means that they
> share pages, unless either of the processes write to a page, in which
> case the OS then duplicates the page.
>
> This means that if a 400M program forks and then execs another process,
> you don't need 800M of ram to do it, and all it does is insert a process
> into the process list (thus adding a little struct to a table).
>
> So - is there something I am missing?

    "Copy-On-Write" relies on page-protection "read-only". After a fork()
 you are guaranteed to have exact copy of all proccess image, including
 read/write data parts. Now, to implement "Copy-On-Write" for all data
 squid uses, OS should mark all parent proccess pages to be read-only
 just for the sake of child process - this is quite an overhead and as
 parent process still probably modifies most pages all the time, the
 copy-on-write would still duplicate all pages, but later, via pagefaults.

 As all this would slow down both processes in overall, OS-es do not do
 that for data pages, instead they copy full proccess images. To overcome
 this overhead, algoritmic changes are needed, and this is exactly what
 stub process is for.

-------------------------------------------------------------------
 Andres Kroonmaa Telefon: 6308 909
 Network administrator
 E-mail: andre@ml.ee Phone: (+372) 6308 909
 Organization: MicroLink Online
 EE0001, Estonia, Tallinn, Sakala 19 Fax: (+372) 6308 901
-------------------------------------------------------------------
Received on Tue Jul 29 2003 - 13:15:41 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:18 MST