Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

csched(3) [debian man page]

CSCHED(3)						     Common Library Functions							 CSCHED(3)

NAME
Csched - LCG Scheduling inferface SYNOPSIS
#include <Csched_api.h> int Csched_getschedparam(int cid, int *policy, Csched_param_t *param); int Csched_setschedparam(int cid, int policy, Csched_param_t *param); int Csched_get_priority_min(int policy); int Csched_get_priority_mid(int policy); int Csched_get_priority_max(int policy); ERRORS
Beyond the errno value, Csched is setting the serrno value to generic values that are described in Cthread(1). DESCRIPTION
Csched is a common API interface for scheduling of multithreaded programs. Csched_getschedparam retrieves the current scheduling policy and priority of the thread referenced with Cthread's id cid. The policy can be CSCHED_OTHER, CSCHED_FIFO, CSCHED_RR, CSCHED_FG_NP or CSCHED_BG_NP. The param structure contains a member, named sched_priority , where will be stored the current priority of the thread you ask for. Please read the NOTES section. Return value is 0 on success, or -1 on error. Csched_setschedparam sets the scheduling policy and priority of the thread referenced with Cthread's id cid. The policy can be CSCHED_OTHER, CSCHED_FIFO, CSCHED_RR, CSCHED_FG_NP or CSCHED_BG_NP. You are neverthless warned that the recommended scheduling is CSCHED_OTHER. Trying to use another scheduling is an opendoor to processor deadlock if you do not code with extreme care. Furthermore, except CSCHED_OTHER , it is not guaranteed that the other possible values ( CSCHED_CSCHED_FIFO, CSCHED_RR, CSCHED_FG_NP or CSCHED_BG_NP ) are supported or implemented on your platform. The param structure contains a member, named sched_priority , where is given the priority of the thread you want the attributes to be modified. Its value can vary from Csched_get_priority_min(policy) to Csched_get_prior- ity_max(policy). Please read the NOTES section. Return value is 0 on success, or -1 on error. Csched_get_priority_min, Csched_get_priority_mid and Csched_get_priority_max are returning the minimum, medium and maximum allowed priori- ties, respectively, vs. the given policy. The output is the one that you use in the sched_priority member of the Csched_param_t structure. Please read the NOTES section. Return value is != -1 on success, or -1 on error. NOTES
About scheduling, the Csched interface defines CSCHED_OTHER, CSCHED_FIFO, CSCHED_RR, CSCHED_FG_NP and CSCHED_BG_NP for portability issue. This does not mean that all those schedulings are supported on the platform you are running on. In particular, only CSCHED_OTHER is offi- cially supported everywhere. The other scheduling policies are totally system dependent and do not conform to any standardisation. Please be aware, also, that using a scheduling other than CSCHED_OTHER is an opendoor to processor deadlock... Finally, on some OSes, the scheduling interfaces are not necessarly in the thread library, nor in the C library. In particular, on Digital you may find them in librt, and on Solaris in libposix4. SEE ALSO
Cthread AUTHOR
LCG Grid Deployment Team LCG
$Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $ CSCHED(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