X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6469039BE430
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1623374176;
	bh=PtEZr5GPo//nPm//hZCMa2HqaauXB4kM8golyd17HjI=;
	h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=Zld3u8Mh7URfY8NOK2IsXVc8ily7bizcIzHMLbBeqYIKeavQ1GAjks1OoJAWlkxMp
	 xiSSUqeWDRQTvRnEhwazSu8S0motnfk0F4Qh2RvkQ6n/HMKu9Akllhn0pZOpp3ZHBP
	 4eGrBPu6LrAR8wECmKuAHQoGFjlFe79bR23BfM2E=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B04E386102A
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Bu/bxDYQ5gejTDc5q6wjqT3yZo/QjJhhHBfcB/Ll0juQA4XAG+rPs/fhItL1XjdZk3ymwGwCjJulcLZp6LxrKn1Doco9BTa77Wh48iFiaTnXF2zxSVJwRNVDWDTf57j2oKQo8hZ88FagnjC1Beb0B0EudaeueoIn1+pUNEcTfQGJz1viJFvgfHet8nf4TUT6LR/PMQNeBHa9lw7ty4J1jAr6s7kQr1GyCOVIwwdge0JHnnfA0OaXgLSdb0w/NpmsfesZxO3/aGb+92/P/EZ3UE+Wc0BAsC6tu4clvUzpQdSZdCohKdPbnLrdI+7p+SKPjATEvCC4B+qUde5QwJpxjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=/Jv7QjpgjAH1338px1hDZNQSN4a5jeyHsyaQj5BAq1g=;
 b=YVTocEHKubdVvHZluVhRoW4pIWcTG7aFIAZPOz1Bd+UWtxoOGr2UNbd3R3Y+oentCSVD1BUUuiVmdCfCJvqW4enGWEDw0rggBnxTXqKq4azechK7lAnJA9tpwbR4RhPVmKkcEwSTQ0eeNc4m5k+kZjrjDBV3PXP79vmyyLYvvaN4GJrDnrNCB0BpJSNiQaKsoW7TRBMv4VQVjXTE6kitPANLWzdMZRyxn8gA+EcWJxbkFKzrIqd6MVVQ0abPNq6mNsdKMJksCn8lhVZctDYTDMsuaRJPffIU12WS3+5GncIVGBx8RIxlcmX3ohXqoiJzOzV5QaG05xF9sD1Ls3LozQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: C++ program using <thread>
Thread-Topic: C++ program using <thread>
Thread-Index: AQHXXloUfWxIj6vFVUWTHSDYhzgpiA==
Date: Fri, 11 Jun 2021 01:14:59 +0000
Message-ID: <DM5PR19MB09861555268510B78F6304FD93349@DM5PR19MB0986.namprd19.prod.outlook.com>
Accept-Language: fr-CA, en-US
Content-Language: fr-CA
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-incomingtopheadermarker: OriginalChecksum:6993D4F0608D5BD0E690BFEAD983DB87D812BF317159760DD2A5A506A39BF1D5;
 UpperCasedChecksum:FD3247CCCE659E0F7220A53BDCD79A41DAFC280C1CB805090DF1B5318F56BE5F;
 SizeAsReceived:6616; Count:41
x-tmn: [+iuY+dwZMaPWYr1PavHNuJGALrj29QnU]
x-ms-publictraffictype: Email
x-incomingheadercount: 41
x-eopattributedmessage: 0
x-ms-office365-filtering-correlation-id: 63b4a254-c7bd-4969-c84a-08d92c765558
x-ms-traffictypediagnostic: MW2NAM10HT045:
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: dT5XyYBURRJswUIRjmQhFFzkhZBL6ZGeliBlY/oaSNi8duuHHJyljVf+WeqGa2yim+7UhdHOZGvlPReVC0MApLQswqOcFyFdnfT/1b/7FIagdXXHIJZH6qI2WHwj26JuAGjZsI7Yka3X+MXh/624Nh98qdcSHG4tvA7Om5qPQ2b1Q1bjFluDnxTGWJcfZp83xa5WVDMxQgJeExzps8NpAathikacKPEK7hAtR9WYZ7uwtI8siZEOpZuqm00D/M6/mx1zMZ59A7IWgoW6IKv2teD/DAY1W2vXyqNPXzomAjPdpLOfPl9Ke82RkSPsDlPvuCNfm+AB2j48PTaNR0iFR35EFu7CqTgNDz0Usy6x1udWvmyfkza5z/SGq6w8k8LZxNlqbHtgnZ+do+40QcR08Q==
x-ms-exchange-antispam-messagedata: +IgbwglqeYEtOMmw1rT1uNb9D3dSUs3A2B6YIePSh5yNsHHh1hfNpLfjhf7re2qOV8VOT3qJwtsdV+1e+fCt2+3SYbeZz1Yz1BsMt0uZ75y3DaZOeO5lkvzCDw4Pyii09NiKkKt9rxSjLYFBVZJf/Q==
x-ms-exchange-transport-forked: True
MIME-Version: 1.0
X-OriginatorOrg: hotmail.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT068.eop-nam10.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 63b4a254-c7bd-4969-c84a-08d92c765558
X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2021 01:14:59.8091 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM10HT045
X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS,
 TXREP autolearn=ham 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@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: =?utf-8?q?Andr=C3=A9_Bleau_via_Cygwin?= <cygwin@cygwin.com>
Reply-To: =?iso-8859-1?Q?Andr=E9_Bleau?= <Andre_Bleau@hotmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 15B1GJ0b008853

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?

Regards,

- André Bleau

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

