delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/01/13:12:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_05,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Magnus Holmgren <magnushol AT gmail DOT com>
Subject: Re: Cygwin slow on x64 systems
Date: Wed, 1 Sep 2010 17:12:19 +0000 (UTC)
Lines: 38
Message-ID: <loom.20100901T190726-553@post.gmane.org>
References: <4C7B9327 DOT 9030204 AT graphtech DOT co DOT il> <loom DOT 20100831T222419-914 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Magnus Holmgren <magnushol <at> gmail.com> writes:

> I did some testing on my 64-bit Vista system, and it appears that 
> CreateThread is the main cause.

I think I've found the reason for the slow CreateThread. It seems like
the following remark in the MSDN documentation is relevant, at least for
WOW64 processes:

 * During process startup and DLL initialization routines, new threads can
   be created, but they do not begin execution until DLL initialization is
   done for the process.

To test this, I removed the call to sigproc_init in dll_crt0_0 and made sure 
it was always called in dll_crt0_1 instead. Suddenly the sigp thread started 
executing immediately, and its initialization was complete long before 
wait_for_sigthread was called.

Even with this change, a "date loop" isn't blazingly fast on my computer
(cygwin1.dll created from 1.7.7 sources, first number is executions per
second):

     26 Wed Sep  1 18:47:36 WEDT 2010
     27 Wed Sep  1 18:47:37 WEDT 2010
     26 Wed Sep  1 18:47:38 WEDT 2010

But it is a clear improvement (using the stock 1.7.6 dll):

      9 Wed Sep  1 18:52:35 WEDT 2010
      9 Wed Sep  1 18:52:36 WEDT 2010
      9 Wed Sep  1 18:52:37 WEDT 2010

PS. There are a few trace printfs in cygthread::create that uses "name" in 
the argument list to print the thread name. That doesn't work nearly as well 
as "__name". :)

  Magnus



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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019