delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/03/21/05:44:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Subject: RE: OT: possible project/research project
Date: Thu, 21 Mar 2002 21:41:20 +1100
MIME-Version: 1.0
Message-ID: <FC169E059D1A0442A04C40F86D9BA76062E2@itdomain003.itdomain.net.au>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>, <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g2LAiaE24141


> -----Original Message-----
> From: Gary R. Van Sickle [mailto:g DOT r DOT vansickle AT worldnet DOT att DOT net] 
> Sent: Thursday, March 21, 2002 2:32 PM

> The thing is, a lot of work *has* been done to make fork as 
> efficient as possible.  But there's a limit on how fast you 
> can create a new process and duplicate the current one into 
> it.  And Windows doesn't go out of its way to help.

Also worth considering is the implicit overhead (both with and without
optimisations such as copy-on-write) of duplicating a process and then
replacing the image vs creating a process from a image.

In reverse order, a) loading the image is the same in both cases:
library path searches, permission checks, prologue code, and then you
are in business. So however fast one of these is made, the other can
match.

b) A process really is just a bunch of kernel structures: memmory map +
page tables , environment block, permissions block, ownership,
threads... and actual virtual memory.

Duplicating a process requires (in general terms):
Copying all the kernel structures.
Fixing them up - adjust child relationship, pid etc.
Assign new virtual memory (may be same via cow) mapped to the original
address's in the process

Note that the amount of work is directly related to the size of the
process. Forking 4Gb of VM is always going to be more work that forking
20kb of VM.

Creating a process requires (in general terms):
Creating empty kernel structures with appropriate values.
Assign the first VM page.
Mapping the image in - fixup library requirements etc. (from a)).

So the unique aspect of creating a process is
Creating empty kernel structures with appropriate values.
Assign the first VM page.

To compare then, you have a near-constant 'trivial' new process overhead
(spawn) vs a variable overhead (but almost guaranteed to be greater
(that is barring corner cases)) than new process overhead (fork + exec).

Hmm, which seems more efficient? 

Lol,
Rob

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019