delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/07/16:53:08

X-Spam-Check-By: sourceware.org
Date: Wed, 7 Mar 2007 16:52:44 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin speed
Message-ID: <20070307215243.GA14556@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <45E86FFD DOT 7060301 AT princeton DOT edu> <45E876FA DOT 7401B017 AT dessent DOT net> <20070305011713 DOT GG6734 AT ns1 DOT anodized DOT com> <45EF1CED DOT 608 AT t-online DOT de>
Mime-Version: 1.0
In-Reply-To: <45EF1CED.608@t-online.de>
User-Agent: Mutt/1.5.11
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Wed, Mar 07, 2007 at 09:13:33PM +0100, Christian Franke wrote:
>Christopher Layne wrote:
>>On Fri, Mar 02, 2007 at 11:11:54AM -0800, Brian Dessent wrote:
>>>Vinod Gupta wrote:
>>>
>>>>Cygwin was a slow by a factor of 3x. Is that normal?
>>>Yes.  Emulation of POSIX functions which do not exist on Windows is
>>>expensive.  Fork is especially bad, which is all you're really testing
>>>there.
>>
>>Where is the *continual* fork in his script btw?
>
>There is no fork at all, the script uses only builtin shell commands.
>
>This command prints the fork() count of a script on Cygwin:
>
>$ strace bash ./script.sh | grep -c 'fork: 0 = fork()'
>
>
>One reason for the slow execution of the script are >8000000 context 
>switches done by Cygwin.
>
>Bash calls sigprocmask() before starting each command, even for builtin 
>commands.
>Cygwin's sigprocmask() unconditionally calls sig_dispatch_pending().
>This is necessary because POSIX requires that at least one pending 
>signal is dispatched by sigprocmask().
>sig_dispatch_pending() sends a __SIGFLUSH* to self and this causes 2 
>thread context switches: main->sig->main.
>
>With the attached patch, sigprocmask() does nothing if the signal mask 
>is not changed.
>This reduces the context switches to <5000.
>(Patch is only intended for testing, it at least breaks above POSIX rule)

I removed the sig_dispatch_pending from handle_sigprocmask.  I don't see
any need for extra logic beyond that since you're doing tests that are
already being done in set_signal_mask.

I'll generate a snapshot with these changes for testing.

Thanks for the patch.

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