Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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/