Csched(3) 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_priority_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 priorities, 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 officially 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.

AUTHOR

LCG Grid Deployment Team