delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org E89E9384B110 |
Authentication-Results: | sourceware.org; |
dmarc=none (p=none dis=none) header.from=maxrnd.com | |
Authentication-Results: | sourceware.org; spf=none smtp.mailfrom=maxrnd.com |
Subject: | Re: C++ program using <thread> |
To: | cygwin AT cygwin DOT com |
References: | <DM5PR19MB09861555268510B78F6304FD93349 AT DM5PR19MB0986 DOT namprd19 DOT prod DOT outlook DOT com> |
From: | Mark Geisert <mark AT maxrnd DOT com> |
Message-ID: | <d8a79a59-cdc4-6127-053f-496e5bade2d9@maxrnd.com> |
Date: | Thu, 10 Jun 2021 22:52:02 -0700 |
User-Agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 |
Firefox/52.0 SeaMonkey/2.49.4 | |
MIME-Version: | 1.0 |
In-Reply-To: | <DM5PR19MB09861555268510B78F6304FD93349@DM5PR19MB0986.namprd19.prod.outlook.com> |
X-Spam-Status: | No, score=-3.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, |
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, | |
TXREP autolearn=no autolearn_force=no version=3.4.2 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
server2.sourceware.org | |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 15B5qneo000376 |
Hi André, André Bleau via Cygwin wrote: > Hi all, > > I have a small C++ program using <thread>. Mainly, I have a series of long tasks for which I can use a chosen number of threads. I create a given number of instances of the std::thread class, each executing the same function but with different data. After launching the threads, my program waits for the results by calling thread.join() on each thread. Some threads finish sooner than others, depending on the data they process. > > I have 16 cores with hyperthreading, so 32 virtual cores. I tried a big run with 63 threads. > > If I compile as a Cygwin program with g++ 10.2.0, when the program runs with 63 threads the CPU load for the program never exceeds 6 or 7%. It remains constants when some of the threads finish, unless the number of threads remaining goes down to about 4. > > If I compile as a Mingw program with x86_64-w64-mingw32-c++ 10.2.0, when the program runs with 63 threads the CPU load for the program reaches 98% then gradually diminishes as threads finish their task. > > Needless to say, the total running time for the Mingw version is much shorter. > > So, is there a limit to the CPU load that a threaded Cygwin program can get? If yes, how can it be changed? Fascinating report; thanks! I doubt there's an intentional limit, but perhaps there is some difference between the Cygwin and MinGW environments that explains the symptoms. No idea at this point though. Oh, does your program set process or thread affinity anywhere? Would you be able to post the source of your test program, or provide it to me by private email? I would run my cygmon profiler on it to look for clues. There have been several other reports of multi-threaded programs taking far too long to complete, but the reports came in as possibly malloc-related issues so they may differ from yours. But cygmon has found something troubling in those cases that I'm still investigating. Regards, ..mark -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |