fork and exec (was: Re: Proposed patch to system.XWinrc)

View: New views
7 Messages — Rating Filter:   Alert me  

fork and exec (was: Re: Proposed patch to system.XWinrc)

by Andy Koppe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Andy

--
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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Vincent R. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 1 Jul 2009 11:11:56 -0400, Christopher Faylor
<cgf-use-the-mailinglist-please@...> wrote:

> 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
>
About that I wanted to make some benchmark with strace and give you figures
about cygwin
running on Windows 7 64 bits and Windows XP 32 bits.Unfortunately I have
only installed natively Windows 7
and I did my test in a Virtual machine but I got some weirds figures where
it was also very slow on XP.
If some people have Windows XP and windows vista (32 or 64 bits) on the
same machine it could be interesting to provide some benchmarks.

and when I say benchmark I want exactly the same machine running the same
cygwin version or it won't be very relevant.



--
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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 01, 2009 at 05:32:14PM +0200, Vincent R. wrote:

>On Wed, 1 Jul 2009 11:11:56 -0400, Christopher Faylor
><cgf-use-the-mailinglist-please@...> wrote:
>> 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.
>
>About that I wanted to make some benchmark with strace and give you
>figures about cygwin running on Windows 7 64 bits and Windows XP 32
>bits.Unfortunately I have only installed natively Windows 7 and I did
>my test in a Virtual machine but I got some weirds figures where it was
>also very slow on XP.  If some people have Windows XP and windows vista
>(32 or 64 bits) on the same machine it could be interesting to provide
>some benchmarks.
>
>and when I say benchmark I want exactly the same machine running the
>same cygwin version or it won't be very relevant.

No one is asking for benchmarks! However, if we were, strace is
particularly unsuitable for that task.  If you want to see improvements
happen then dive into the code and offer specific suggestions.

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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Vincent R. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 1 Jul 2009 12:06:22 -0400, Christopher Faylor
<cgf-use-the-mailinglist-please@...> wrote:

> On Wed, Jul 01, 2009 at 05:32:14PM +0200, Vincent R. wrote:
>>On Wed, 1 Jul 2009 11:11:56 -0400, Christopher Faylor
>><cgf-use-the-mailinglist-please@...> wrote:
>>> 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.
>>
>>About that I wanted to make some benchmark with strace and give you
>>figures about cygwin running on Windows 7 64 bits and Windows XP 32
>>bits.Unfortunately I have only installed natively Windows 7 and I did
>>my test in a Virtual machine but I got some weirds figures where it was
>>also very slow on XP.  If some people have Windows XP and windows vista
>>(32 or 64 bits) on the same machine it could be interesting to provide
>>some benchmarks.
>>
>>and when I say benchmark I want exactly the same machine running the
>>same cygwin version or it won't be very relevant.
>
> No one is asking for benchmarks! However, if we were, strace is
> particularly unsuitable for that task.  If you want to see improvements
> happen then dive into the code and offer specific suggestions.
>
> cgf

I did but maybe it would be important to know for sure that the problem
comes from fork and
exec because I think you are sharing the same code with mingw and it runs a
lot faster with it.
So before I dive :

1) I want to be sure that fork/exec are the reason
2) See the differences with mingw.

I don't think there lots of different ways of implementing that two
functions




--
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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 01, 2009 at 06:52:38PM +0200, Vincent R. wrote:

>On Wed, 1 Jul 2009 12:06:22 -0400, Christopher Faylor
>> No one is asking for benchmarks! However, if we were, strace is
>> particularly unsuitable for that task.  If you want to see improvements
>> happen then dive into the code and offer specific suggestions.
>
>I did but maybe it would be important to know for sure that the problem
>comes from fork and exec because I think you are sharing the same code
>with mingw and it runs a lot faster with it.  So before I dive :
>
>1) I want to be sure that fork/exec are the reason
>2) See the differences with mingw.

If you think we're sharing process creation code with MinGW then you
have a misunderstanding about the nature of the projects.  One of the
main reasons for MinGW is that they want to do everything natively.
That is obviously not the case with Cygwin.

If you are talking about MSYS then, the last time I checked, we were
actually slightly faster.  I obviously can't tell you what to do but I
doubt that comparing the current version of Cygwin against an ancient
hacked version of Cygwin (i.e., MSYS) is going to be very useful.

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


Re: fork and exec (was: Re: Proposed patch to system.XWinrc)

by Vincent R. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 1 Jul 2009 13:32:46 -0400, Christopher Faylor
<cgf-use-the-mailinglist-please@...> wrote:

> On Wed, Jul 01, 2009 at 06:52:38PM +0200, Vincent R. wrote:
>>On Wed, 1 Jul 2009 12:06:22 -0400, Christopher Faylor
>>> No one is asking for benchmarks! However, if we were, strace is
>>> particularly unsuitable for that task.  If you want to see improvements
>>> happen then dive into the code and offer specific suggestions.
>>
>>I did but maybe it would be important to know for sure that the problem
>>comes from fork and exec because I think you are sharing the same code
>>with mingw and it runs a lot faster with it.  So before I dive :
>>
>>1) I want to be sure that fork/exec are the reason
>>2) See the differences with mingw.
>
> If you think we're sharing process creation code with MinGW then you
> have a misunderstanding about the nature of the projects.  One of the
> main reasons for MinGW is that they want to do everything natively.
> That is obviously not the case with Cygwin.
>
I know that.

> If you are talking about MSYS then, the last time I checked, we were
> actually slightly faster.  
I will check this affirmation.

> I obviously can't tell you what to do but I
> doubt that comparing the current version of Cygwin against an ancient
> hacked version of Cygwin (i.e., MSYS) is going to be very useful.
>

Ok so no more proposal.
<autosuggestion mode>
But after all why am I so interested in reducing compilation time on cygwin
because now I have time to take 10 coffees, read all my emails, ...
</autosuggestion mode>




--
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