Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001293 [1003.1(2016)/Issue7+TC2] Base Definitions and Headers Editorial Enhancement Request 2019-09-27 19:53 2019-09-30 08:59
Reporter joelsherrill View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Joel Sherrill
Organization RTEMS.org
User Reference
Section pthread.h and add sys/cpuset.h
Page Number NA - addition request
Line Number NA - addition request
Interp Status ---
Final Accepted Text
Summary 0001293: Add methods associated with manipulating pthread affinity on SMP systems
Description At least FreeBSD, Linux, and RTEMS implement a very similar set of methods to support manipulation of pthread affinity on SMP systems. This is a proposal to consider the addition of a set of methods supporting this capability. The end solution should include the capabilities in existing implementations but needs to standardize the method signatures and types.

- sys/cpuset.h defines a data structure which is a bitmap representing the affinity set and operations on that structure. It is similar in concept to sigset_t but beyond filling and clearing operations, there methods that are more like boolean operations. Ref for Linux:

- pthread.h includes methods to set the affinity as part of the pthread_attr_t that is set at creation time and dynamically. The dynamic methods on Linux are defined as:

       #include <pthread.h>

       int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
                                  const cpu_set_t *cpuset);
       int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize,
                                  cpu_set_t *cpuset);

Those that set the attribute are defined as:

       #include <pthread.h>

       int pthread_attr_setaffinity_np(pthread_attr_t *attr,
                          size_t cpusetsize, const cpu_set_t *cpuset);
       int pthread_attr_getaffinity_np(const pthread_attr_t *attr,
                          size_t cpusetsize, cpu_set_t *cpuset);
Desired Action Add support for manipulation of pthread affinity.
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0004574)
Konrad_Schwarz (reporter)
2019-09-30 08:59

I am pretty sure affinity was not included in Pthreads because the
heterogeneity of NUMA machines made it too difficult to define a useful API.

I.e., code running on super computers ideally requires the ability to figure
out the interconnection speed of cores: are two cores merely hardware
("hyper") threads, or co-located on the same chip,
or connected via a backplane?

- Issue History
Date Modified Username Field Change
2019-09-27 19:53 joelsherrill New Issue
2019-09-27 19:53 joelsherrill Name => Joel Sherrill
2019-09-27 19:53 joelsherrill Organization => RTEMS.org
2019-09-27 19:53 joelsherrill Section => pthread.h and add sys/cpuset.h
2019-09-27 19:53 joelsherrill Page Number => NA - addition request
2019-09-27 19:53 joelsherrill Line Number => NA - addition request
2019-09-30 08:59 Konrad_Schwarz Note Added: 0004574


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker