Manual Pages for Linux CentOS command on man pthread_attr_setscope
MyWebUniversity

Manual Pages for Linux CentOS command on man pthread_attr_setscope

PTHREADATTRSETSCOPE(3) Linux Programmer's Manual PTHREADATTRSETSCOPE(3)

NAME

pthreadattrsetscope, pthreadattrgetscope - set/get contention scope attribute in thread attributes object SYNOPSIS

#include int pthreadattrsetscope(pthreadattrt *attr, int scope); int pthreadattrgetscope(pthreadattrt *attr, int *scope);

Compile and link with -pthread. DESCRIPTION The pthreadattrsetscope() function sets the contention scope attribute of the thread attributes object referred to by attr to the value specified in scope. The contention scope attribute defines the set of threads against which a thread competes for resources such as

the CPU. POSIX.1-2001 specifies two possible values for scope: PTHREADSCOPESYSTEM The thread competes for resources with all other threads in all processes on the system that are in the same scheduling alloca‐ tion domain (a group of one or more processors). PTHREADSCOPESYSTEM threads are scheduled relative to one another according to their scheduling policy and priority. PTHREADSCOPEPROCESS The thread competes for resources with all other threads in the same process that were also created with the PTHREADSCOPEPROCESS contention scope. PTHREADSCOPEPROCESS threads are scheduled relative to other threads in the process

according to their scheduling policy and priority. POSIX.1-2001 leaves it unspecified how these threads contend with other threads in other process on the system or with other threads in the same process that were created with the PTHREADSCOPESYSTEM contention scope.

POSIX.1-2001 requires that an implementation support at least one of these contention scopes. Linux supports PTHREADSCOPESYSTEM, but not PTHREADSCOPEPROCESS. On systems that support multiple contention scopes, then, in order for the parameter setting made by pthreadattrsetscope() to have effect when calling pthreadcreate(3), the caller must use pthreadattrset‐

inheritsched(3) to set the inherit-scheduler attribute of the attributes object attr to PTHREADEXPLICITSCHED. The pthreadattrgetscope() function returns the contention scope attribute of the thread attributes object referred to by attr in the buffer pointed to by scope. RETURN VALUE On success, these functions return 0; on error, they return a nonzero error number. ERRORS pthreadattrsetscope() can fail with the following errors: EINVAL An invalid value was specified in scope. ENOTSUP scope specified the value PTHREADSCOPEPROCESS, which is not supported on Linux. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌─────────────────────────┬───────────────┬─────────┐ │Interface │ Attribute │ Value │ ├─────────────────────────┼───────────────┼─────────┤

│pthreadattrsetscope(), │ Thread safety │ MT-Safe │ │pthreadattrgetscope() │ │ │ └─────────────────────────┴───────────────┴─────────┘ CONFORMING TO

POSIX.1-2001. NOTES The PTHREADSCOPESYSTEM contention scope typically indicates that a

user-space thread is bound directly to a single kernel-scheduling entity. This is the case on Linux for the obsolete LinuxThreads imple‐ mentation and the modern NPTL implementation, which are both 1:1 threading implementations.

POSIX.1-2001 specifies that the default contention scope is implementa‐

tion-defined. SEE ALSO pthreadattrinit(3), pthreadattrsetaffinitynp(3), pthreadattrsetinheritsched(3), pthreadattrsetschedparam(3), pthreadattrsetschedpolicy(3), pthreadcreate(3), pthreads(7) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2013-04-19 PTHREADATTRSETSCOPE(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™