Allocating a thread to a specific processor core

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Allocating a thread to a specific processor core

John Emmas-2
When using 'pthread_create()' (on Windows) is it possible to specify a
preferred processor/core for the thread to run on (in the attributes maybe?)

Windows itself has a function for doing this but I just wondered if
there's anything similar that's already available in libpthread?

https://msdn.microsoft.com/en-us/library/windows/desktop/ms686253%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Thanks,

John
Reply | Threaded
Open this post in threaded view
|

Re: Allocating a thread to a specific processor core

ross.johnson
John, 
I notice your question came via the old Red Hat sourceware repository mailing list. The project moved to sourceforge several years ago.
The current head revision at
https://sourceforge.net/p/pthreads4w/wiki/Home/
(code at)
https://sourceforge.net/p/pthreads4w/code/ci/master/tree/
provides the following functions:
pthread_attr_getaffinity_nppthread_attr_setaffinity_nppthread_getaffinity_nppthread_setaffinity_np
and supporting  macros/functions:
CPU_ZEROCPU_EQUALCPU_COUNTCPU_SETCPU_CLRCPU_ISSETCPU_ANDCPU_ORCPU_XOR
They follow the Linux functions of the same name. See the manual pages included in the code repository.
In case you're looking for binary versions of the library,  the Sourceforge project doesn't produce built versions of the library anymore, assuming that users will be able to and prefer to build their own.
RegardsRoss
Sent from my phone
-------- Original message --------From: John Emmas <[hidden email]> Date: 14/5/18  6:08 pm  (GMT+10:00) To: [hidden email] Subject: Allocating a thread to a specific processor core
When using 'pthread_create()' (on Windows) is it possible to specify a
preferred processor/core for the thread to run on (in the attributes maybe?)

Windows itself has a function for doing this but I just wondered if
there's anything similar that's already available in libpthread?

https://msdn.microsoft.com/en-us/library/windows/desktop/ms686253%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Thanks,

John
Reply | Threaded
Open this post in threaded view
|

Re: Allocating a thread to a specific processor core

John Emmas-2
On 14/05/2018 11:29, ross.johnson wrote:
>
> I notice your question came via the old Red Hat sourceware repository
> mailing list. The project moved to sourceforge several years ago.
>
> The current head revision at
>
> https://sourceforge.net/p/pthreads4w/wiki/Home/
>

Thanks Ross - after I posted this morning, I realised there's only been
one or two posts here since 2013!  So I figured it must have moved
somewhere.

Having said that... the above home page states that there's no mailing
list on Sourceforge yet.  So is there one somewhere else?

John