Austin Group Defect Tracker

Aardvark Mark IV

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-10-17 15:59
Reporter joelsherrill View Status public  
Assigned To
Priority normal Resolution Rejected  
Status Closed  
Name Joel Sherrill
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 See Note: 0004624.
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
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?
Don Cragun (manager)
2019-10-17 15:58

This was discussed during the 2019-10-17 conference call: As noted in Note: 0004574, this problem has very hardware specific issues. Since the POSIX standards are not intended to be hardware specific, we do not feel that this is an appropriate set of interfaces to be included at this time... If another standards body does produce a standard in this area that provides generic hardware support, we will then consider referencing that standard the same way POSIX.1-2018 references the 1999 C Standard.

But also note that this seems to be a type of system configuration and resource availability issue that is specifically listed as outside the scope of the current standard in Section 1.1 Scope in the Introduction to the current standard. OpenMP is a group that is working in this area.

This enhancement request is rejected.

- 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 =>
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
2019-10-17 15:58 Don Cragun Note Added: 0004624
2019-10-17 15:59 Don Cragun Interp Status => ---
2019-10-17 15:59 Don Cragun Final Accepted Text => See Note: 0004624.
2019-10-17 15:59 Don Cragun Resolution Open => Rejected
2019-10-17 15:59 Don Cragun Status New => Closed

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