Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_setschedparam(3) [osf1 man page]

pthread_setschedparam(3)				     Library Functions Manual					  pthread_setschedparam(3)

NAME
pthread_setschedparam - Changes a thread's scheduling policy and scheduling parameters. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_setschedparam( pthread_t thread, int policy, const struct sched_param *param); STANDARDS
interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
Thread whose scheduling policy and parameters are to be changed. New scheduling policy value for the thread specified in thread. The fol- lowing are valid values: SCHED_BG_NP SCHED_FG_NP SCHED_FIFO SCHED_OTHER SCHED_RR See Guide to DECthreads for a description of the schedul- ing policies. New values of the scheduling parameters associated with the scheduling policy for the thread specified in thread. Valid values for the sched_priority field of a sched_param structure depend on the chosen scheduling policy. Use the POSIX routines sched_get_priority_min(3) or sched_get_priority_max(3) to determine the low and high limits of each policy. Additionally, DECthreads pro- vides nonportable priority range constants, as follows: PRI_FIFO_MIN (low) to PRI_FIFO_MAX (high) PRI_RR_MIN (low) to PRI_RR_MAX (high) PRI_OTHER_MIN (low) to PRI_OTHER_MAX (high) PRI_FG_MIN_NP (low) to PRI_FG_MAX_NP (high) PRI_BG_MIN_NP (low) to PRI_BG_MAX_NP (high) The default priority varies by DECthreads platform. On Tru64 UNIX, the default is 19 (that is, the POSIX priority of a normal timeshare process). On the non-UNIX platforms, the default priority is the midpoint between PRI_FG_MIN_NP and PRI_FG_MAX_NP. DESCRIPTION
This routine changes both the current scheduling policy and associated scheduling parameters of the thread specified by thread to the pol- icy and associated parameters provided in policy and param, respectively. All currently implemented DECthreads scheduling policies have one scheduling parameter called sched_priority. For the policy you choose, you must specify an appropriate value in the sched_priority field of the sched_param structure. Changing the scheduling policy or priority, or both, of a thread can cause it to start executing or to be preempted by another thread. A thread changes its own scheduling policy and priority by using the handle returned by the pthread_self(3) routine. This routine differs from pthread_attr_setschedpolicy(3) and pthread_attr_setschedparam(3), in that those routines set the scheduling pol- icy and parameter attributes that are used to establish the scheduling priority and scheduling policy of a new thread when it is created. However, this routine changes the scheduling policy and parameters of an existing thread. RETURN VALUES
If an error condition occurs, no scheduling policy or parameters are changed for the target thread, and this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The value specified by policy or param is invalid. An attempt was made to set the scheduling policy or a parameter to an unsupported value. The caller does not have the appro- priate privileges to set the scheduling policy or parameters of the specified thread. The value specified by thread does not refer to an existing thread. ERRORS
None RELATED INFORMATION
Functions: pthread_attr_setschedparam(3), pthread_attr_setschedpolicy(3), pthread_create(3), pthread_self(3), sched_yield(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_setschedparam(3)

Check Out this Related Man Page

pthread_getschedparam(3C)												 pthread_getschedparam(3C)

NAME
pthread_getschedparam, pthread_setschedparam - access dynamic thread scheduling parameters SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_getschedparam(pthread_t thread, int *restrict policy, struct sched_param *restrict param); int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param); The pthread_getschedparam() and pthread_setschedparam() functions allow the scheduling policy and scheduling parameters of individual threads within a multithreaded process to be retrieved and set. Supported policies are SCHED_FIFO, SCHED_RR, and SCHED_OTHER. See pthreads(5). For SCHED_FIFO, SCHED_RR, and SCHED_OTHER, the affected scheduling parameter is the sched_priority member of the sched_param structure. The pthread_getschedparam() function retrieves the scheduling policy and scheduling parameters for the thread whose thread ID is given by thread and stores those values in policy and param, respectively. The priority value returned from pthread_getschedparam() is the value specified by the most recent pthread_setschedparam() or pthread_create() call affecting the target thread, and reflects any temporary adjustments to its priority as a result of any priority inheritance or ceiling functions. The pthread_setschedparam() function sets the scheduling policy and associated scheduling parameters for the thread whose thread ID is given by thread to the policy and associated parameters provided in policy and param, respectively. If the pthread_setschedparam() function fails, no scheduling parameters will be changed for the target thread. If successful, the pthread_getschedparam() and pthread_setschedparam() functions return 0. Otherwise, an error number is returned to indi- cate the error. The pthread_getschedparam() function may fail if: ESRCH The value specified by thread does not refer to a existing thread. The pthread_setschedparam() function may fail if: EINVAL The value specified by policy or one of the scheduling parameters associated with the scheduling policy policy is invalid. EPERM The caller does not have the appropriate permission to set either the scheduling parameters or the scheduling policy of the specified thread. ESRCH The value specified by thread does not refer to a existing thread. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ pthread_attr_init(3C), sched_getparam(3RT), sched_setparam(3RT), sched_getscheduler(3RT), sched_setscheduler(3RT), attributes(5), pthreads(5), standards(5) 23 Nov 2005 pthread_getschedparam(3C)
Man Page