This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Making /bin/sh == bash. Has the time come?
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 12 Jun 2005 23:02:23 -0400
- Subject: Re: Making /bin/sh == bash. Has the time come?
- References: <42ACF184.E58BC2A8@dessent.net> <20050613024741.F206213C237@cgf.cx>
- Reply-to: cygwin at cygwin dot com
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/