1CSCHED(3) Common Library Functions
2CSCHED(3)
3
4
5
6[1mNAME[0m
7 [1mCsched [22m‐ [1mLCG Scheduling [22minferface
8
9[1mSYNOPSIS[0m
10 [1m#include <Csched_api.h>[0m
11
12 [1mint Csched_getschedparam(int [4m[22mcid[24m[1m, int
13*[4m[22mpolicy[24m[1m, Csched_param_t *[4m[22mparam[24m[1m);[0m
14
15 [1mint Csched_setschedparam(int [4m[22mcid[24m[1m, int
16[4m[22mpolicy[24m[1m, Csched_param_t *[4m[22mparam[24m[1m);[0m
17
18 [1mint Csched_get_priority_min(int [4m[22mpoli‐
19cy[24m[1m);[0m
20
21 [1mint Csched_get_priority_mid(int [4m[22mpoli‐
22cy[24m[1m);[0m
23
24 [1mint Csched_get_priority_max(int [4m[22mpoli‐
25cy[24m[1m);[0m
26
27
28[1mERRORS[0m
29 Beyond the errno value, [1mCsched [22mis setting the
30serrno value to generic
31 values that are described in [1mCthread[22m(1).
32
33
34[1mDESCRIPTION[0m
35 [1mCsched [22mis a common API interface for scheduling of
36multithreaded pro‐
37 grams.
38
39 [1mCsched_getschedparam [22mretrieves the current schedul‐
40ing policy and prior‐
41 ity of the thread referenced with Cthread’s id [4mcid.[24m
42The [4mpolicy[24m can be
43 [4mCSCHED_OTHER,[24m [4mCSCHED_FIFO,[24m [4mC‐
44SCHED_RR,[24m [4mCSCHED_FG_NP[24m or [4mCSCHED_BG_NP.[0m
45 The [4mparam[24m structure contains a member, named
46[4msched_priority[24m , where
47 will be stored the current priority of the thread you
48ask for. Please
49 read the [1mNOTES [22msection.
50
51 Return value is 0 on success, or ‐1 on error.
52
53 [1mCsched_setschedparam [22msets the scheduling policy
54and priority of the
55 thread referenced with Cthread’s id [4mcid.[24m
56The [4mpolicy[24m can be
57 [4mCSCHED_OTHER,[24m [4mCSCHED_FIFO,[24m [4mC‐
58SCHED_RR,[24m [4mCSCHED_FG_NP[24m or [4mCSCHED_BG_NP.[0m
59 You are neverthless [1mwarned [22mthat the [1mrec‐
60ommended [22mscheduling is
61 [4mCSCHED_OTHER.[24m Trying to use another scheduling is
62an opendoor to pro‐
63 cessor deadlock if you do not code with extreme care.
64Furthermore,
65 except [4mCSCHED_OTHER[24m , it is [1mnot [22mguaranteed
66that the other possible val‐
67 ues ( [4mCSCHED_CSCHED_FIFO,[24m [4mCSCHED_RR,[24m [4mC‐
68SCHED_FG_NP[24m or [4mCSCHED_BG_NP[24m ) are
69 supported or implemented on your platform. The
70[4mparam[24m structure con‐
71 tains a member, named [4msched_priority[24m , where is
72given the priority of
73 the thread you want the attributes to be modified. Its
74value can vary
75 from [1mCsched_get_priority_min([4m[22mpolicy[24m[1m)
76[22mto [1mCsched_get_priority_max([4m[22mpol‐[0m
77 [4micy[24m[1m). [22mPlease read the [1mNOTES [22msection.
78
79 Return value is 0 on success, or ‐1 on error.
80
81 [1mCsched_get_priority_min[22m, [1mCsched_get_priority_mid
82[22mand [1mCsched_get_prior‐[0m
83 [1mity_max are returning the minimum, medium and maximum
84allowed priori‐[0m
85 [1mties, respectively, vs. the given [4m[22mpolicy.[24m
86The output is the one that
87 you use in the [4msched_priority[24m member of the
88Csched_param_t structure.
89 Please read the [1mNOTES [22msection.
90
91 Return value is != ‐1 on success, or ‐1 on error.
92
93[1mNOTES[0m
94 About scheduling, the Csched interface defines
95[4mCSCHED_OTHER,[0m
96 [4mCSCHED_FIFO,[24m [4mCSCHED_RR,[24m [4mC‐
97SCHED_FG_NP[24m and [4mCSCHED_BG_NP[24m for portability
98 issue. This does [1mnot [22mmean that all those schedul‐
99ings are supported on
100 the platform you are running on. In particular, only
101[4mCSCHED_OTHER[24m is
102 officially supported everywhere. The other scheduling
103policies are
104 totally system dependent and do not conform to any
105standardisation.
106 Please be aware, also, that using a scheduling other than
107[4mCSCHED_OTHER[0m
108 is an opendoor to processor deadlock...
109
110 Finally, on some OSes, the scheduling interfaces are not
111necessarly in
112 the thread library, nor in the C library. In particular,
113on Digital you
114 may find them in librt, and on Solaris in libposix4.
115
116
117[1mSEE ALSO[0m
118 [1mCthread[0m
119
120
121[1mAUTHOR[0m
122 [1mLCG Grid Deployment [22mTeam
123
124
125
126LCG $Date$
127CSCHED(3)
128
129
130
131
132