public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "André Bleau" <Andre_Bleau@hotmail.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: C++ program using <thread>
Date: Fri, 11 Jun 2021 01:14:59 +0000	[thread overview]
Message-ID: <DM5PR19MB09861555268510B78F6304FD93349@DM5PR19MB0986.namprd19.prod.outlook.com> (raw)

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

             reply	other threads:[~2021-06-11  1:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  1:14 André Bleau [this message]
2021-06-11  5:52 ` Mark Geisert
2021-06-12  3:04 André Bleau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR19MB09861555268510B78F6304FD93349@DM5PR19MB0986.namprd19.prod.outlook.com \
    --to=andre_bleau@hotmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).