delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/06/12/23:02:34

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Date: Sun, 12 Jun 2005 23:02:23 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Making /bin/sh == bash. Has the time come?
Message-ID: <20050613030223.GC3739@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
References: <42ACF184 DOT E58BC2A8 AT dessent DOT net> <20050613024741 DOT F206213C237 AT cgf DOT cx>
Mime-Version: 1.0
In-Reply-To: <20050613024741.F206213C237@cgf.cx>
User-Agent: Mutt/1.5.8i

On Sun, Jun 12, 2005 at 09:48:25PM -0500, Gary R. Van Sickle wrote:
>>Can I just ask a basic question here?  So if both ash and bash are
>>using the same method of execution (fork), is the reason for bash's
>>slowness due to it just being a larger program with more pages to copy
>>during a fork()?
>
>Fork() also has to dup any and all handles/descriptors/etc, which takes
>all kinds of time.

Actually most handles are just inherited.  Only some of them have to be
duped or recreated -- ttys and sockets are the most notable exceptions.
Some close-on-exec'ed fds have to be closed, too.  With the advent of
the cygheap, most of the inherited information is just one large
"ReadProcessMemory" with a fixups for problematic stuff like sockets.

There are all sorts of other things that fork does, though, like making
half-hearted attempts to load dlls in the same location in the child as
they were in the parent, fixing up mmaps, maintaining a list of handles
to slow pid reuse for bash (is that still needed?), etc.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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