posix thread scaling issue

Mark Geisert mark@maxrnd.com
Sun Sep 3 03:50:36 GMT 2023


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


More information about the Cygwin mailing list