X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 1 Jul 2009 11:11:56 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: fork and exec (was: Re: Proposed patch to system.XWinrc)
Message-ID: <20090701151156.GB335@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <416096c60906302255t1b5bdb41u442ebca20679c8d9@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <416096c60906302255t1b5bdb41u442ebca20679c8d9@mail.gmail.com>
User-Agent: Mutt/1.5.19 (2009-01-05)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Wed, Jul 01, 2009 at 06:55:35AM +0100, Andy Koppe wrote:
>2009/6/23 Christopher Faylor:
>>>If posix_spawn() ever gets implemented in Cygwin to
>>>avoid the slowness of fork(), /bin/sh might well change to the first
>>>shell that supports it.
>>
>> It's really somewhat of an urban myth about Cygwin's fork being slow.
>> Cygwin's exec is also pretty slow. ??I'm not really sure that posix_spawn
>> would cause any kind of performance improvement.
>
>Ah, right. So is it Windows' CreateProcess() itself that's slow? Or is
>it some of the additional stuff that exec() needs to deal with?
>Signals? The hidden console?

The majority of the exec code is in spawn.cc - spawn_guts().  You can
see for yourself that this is not a simple function.

Just remember that neither fork nor exec have native Windows analogues.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

