public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin@cygwin.com
Subject: Re: posix thread scaling issue
Date: Sat, 2 Sep 2023 20:50:36 -0700	[thread overview]
Message-ID: <1a894e01-0dee-7a14-d94a-40034b88275f@maxrnd.com> (raw)
In-Reply-To: <07386659-68b3-a35d-1402-22684f8e5755@Shaw.ca>

Hi folks,

Brian Inglis via Cygwin wrote:
> On 2023-09-02 12:27, jeff via Cygwin wrote:
[...]
>> When I run cinebench, I can get to 100% cpu utulization (at around 3ghz) on 
>> windows.
> 
> Chances are the benchmark is designed to handle that:
> 
> "When the program is running inside the group, unless it is processor group aware, 
> then it can only access other threads in the same group. This means that if a 
> multi-threaded program can use 128 threads, if it isn’t built with processor 
> groups in mind, then it might only spawn with access to 64."
> 
> I also do not know how you would program for that in Cygwin to map onto the 
> equivalent Windows function required.
> 
> Perhaps one of the developers involved could comment here?

Cygwin doesn't know (at user level) about processor groups as that's a Windows 
construct.  Cygwin does know about processor affinity and treats all available 
processors as a contiguous set, like Linux does, up to 1024 in size.  One uses 
'taskset' from the util-linux package to assign processes to specific processor(s).

One can deal with thread affinity using pthread_get_affinity_np() and 
pthread_set_affinity_np() functions provided by the Cygwin DLL.  These are modeled 
after the same-named functions in Linux.  The internals of these functions do have 
to work within the Windows processor group constraints, so not all plausible 
set-affinity operations are allowed by Windows.  Briefly, you can't move a thread 
outside the processor group it's currently in; you have to move its process to the 
new group first.
HTH,

..mark

  parent reply	other threads:[~2023-09-03  3:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02 14:57 jeff
2023-09-02 17:56 ` Brian Inglis
2023-09-02 18:27   ` jeff
2023-09-02 19:59     ` Brian Inglis
2023-09-02 20:04       ` jeff
2023-09-03  6:13         ` ASSI
2023-09-03  3:50       ` Mark Geisert [this message]
2023-09-03  4:13         ` Mark Geisert
2023-09-02 19:30 André Bleau
     [not found] ` <e36d50d5-75d0-40d5-92e2-02d04092fd77@jeffunit.com>
2023-09-02 21:23   ` 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=1a894e01-0dee-7a14-d94a-40034b88275f@maxrnd.com \
    --to=mark@maxrnd.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).