Xenomai
3.1
|
Cobalt/POSIX process scheduling. More...
Functions | |
int | sched_yield (void) |
Yield the processor. More... | |
int | sched_get_priority_min (int policy) |
Get minimum priority of the specified scheduling policy. More... | |
int | sched_get_priority_min_ex (int policy) |
Get extended minimum priority of the specified scheduling policy. More... | |
int | sched_get_priority_max (int policy) |
Get maximum priority of the specified scheduling policy. More... | |
int | sched_setscheduler (pid_t pid, int policy, const struct sched_param *param) |
Set the scheduling policy and parameters of the specified process. More... | |
int | sched_setscheduler_ex (pid_t pid, int policy, const struct sched_param_ex *param_ex) |
Set extended scheduling policy of a process More... | |
int | sched_getscheduler (pid_t pid) |
Get the scheduling policy of the specified process. More... | |
int | sched_getscheduler_ex (pid_t pid, int *policy_r, struct sched_param_ex *param_ex) |
Get extended scheduling policy of a process More... | |
int | sched_get_priority_max_ex (int policy) |
Get extended maximum priority of the specified scheduling policy. More... | |
int | sched_setconfig_np (int cpu, int policy, const union sched_config *config, size_t len) |
Set CPU-specific scheduler settings for a policy More... | |
ssize_t | sched_getconfig_np (int cpu, int policy, union sched_config *config, size_t *len_r) |
Retrieve CPU-specific scheduler settings for a policy More... | |
Cobalt/POSIX process scheduling.
int sched_get_priority_max | ( | int | policy | ) |
Get maximum priority of the specified scheduling policy.
This service returns the maximum priority of the scheduling policy policy.
policy | scheduling policy. |
0 | on success; |
-1 | with errno set if:
|
int sched_get_priority_max_ex | ( | int | policy | ) |
Get extended maximum priority of the specified scheduling policy.
This service returns the maximum priority of the scheduling policy policy, reflecting any Cobalt extension to standard classes.
policy | scheduling policy. |
0 | on success; |
-1 | with errno set if:
|
int sched_get_priority_min | ( | int | policy | ) |
Get minimum priority of the specified scheduling policy.
This service returns the minimum priority of the scheduling policy policy.
policy | scheduling policy. |
0 | on success; |
-1 | with errno set if:
|
int sched_get_priority_min_ex | ( | int | policy | ) |
Get extended minimum priority of the specified scheduling policy.
This service returns the minimum priority of the scheduling policy policy, reflecting any Cobalt extension to the standard classes.
policy | scheduling policy. |
0 | on success; |
-1 | with errno set if:
|
ssize_t sched_getconfig_np | ( | int | cpu, |
int | policy, | ||
union sched_config * | config, | ||
size_t * | len_r | ||
) |
Retrieve CPU-specific scheduler settings for a policy
A configuration is strictly local to the target cpu, and may differ from other processors.
cpu | processor to retrieve the configuration of. |
policy | scheduling policy to which the configuration data applies. Currently, only SCHED_TP and SCHED_QUOTA are valid input. |
config | a pointer to a memory area which receives the configuration settings upon success of this call. |
On successful return, config->quota.tp contains the TP schedule active on cpu.
On entry, config->quota.get.tgid must contain the thread group identifier to inquire about.
On successful exit, config->quota.info contains the information related to the thread group referenced to by config->quota.get.tgid.
[in,out] | len_r | a pointer to a variable for collecting the overall length of the configuration data returned (in bytes). This variable must contain the amount of space available in config when the request is issued. |
int sched_getscheduler | ( | pid_t | pid | ) |
Get the scheduling policy of the specified process.
This service retrieves the scheduling policy of the Cobalt process identified by pid.
If pid does not identify an existing Cobalt thread/process, this service falls back to the regular sched_getscheduler() service.
pid | target process/thread; |
int sched_getscheduler_ex | ( | pid_t | pid, |
int * | policy_r, | ||
struct sched_param_ex * | param_ex | ||
) |
Get extended scheduling policy of a process
This service is an extended version of the sched_getscheduler() service, which supports Cobalt-specific and/or additional scheduling policies, not available with the host Linux environment. It retrieves the scheduling policy of the Cobalt process/thread identified by pid, and the associated scheduling parameters (e.g. the priority).
pid | queried process/thread. If zero, the current thread is assumed. |
policy_r | a pointer to a variable receiving the current scheduling policy of pid. |
param_ex | a pointer to a structure receiving the current scheduling parameters of pid. |
int sched_setconfig_np | ( | int | cpu, |
int | policy, | ||
const union sched_config * | config, | ||
size_t | len | ||
) |
Set CPU-specific scheduler settings for a policy
A configuration is strictly local to the target cpu, and may differ from other processors.
cpu | processor to load the configuration of. |
policy | scheduling policy to which the configuration data applies. Currently, SCHED_TP and SCHED_QUOTA are valid. |
config | a pointer to the configuration data to load on cpu, applicable to policy. |
This call controls the temporal partitions for cpu, depending on the operation requested.
Time slots must be strictly contiguous, i.e. windows[n].offset + windows[n].duration shall equal windows[n + 1].offset. If windows[].ptid is in the range [0..CONFIG_XENO_OPT_SCHED_TP_NRPART-1], SCHED_TP threads which belong to the partition being referred to may be given CPU time on cpu, from time windows[].offset to windows[].offset + windows[].duration, provided those threads are in a runnable state.
Time holes between valid time slots may be defined using windows activating the pseudo partition -1. When such window is active in the global time frame, no CPU time is available to SCHED_TP threads on cpu.
This call manages thread groups running on cpu, defining per-group quota for limiting their CPU consumption.
All three operations fill in the config.info structure with the information reflecting the state of the scheduler on cpu with respect to policy, after the requested changes have been applied.
len | overall length of the configuration data (in bytes). |
int sched_setscheduler | ( | pid_t | pid, |
int | policy, | ||
const struct sched_param * | param | ||
) |
Set the scheduling policy and parameters of the specified process.
This service set the scheduling policy of the Cobalt process identified by pid to the value policy, and its scheduling parameters (i.e. its priority) to the value pointed to by param.
If the current Linux thread ID is passed (see gettid(2)), this service turns the current regular POSIX thread into a Cobalt thread. If pid is neither the identifier of the current thread nor the identifier of an existing Cobalt thread, this service falls back to the regular sched_setscheduler() service.
pid | target process/thread; |
policy | scheduling policy, one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER; |
param | scheduling parameters address. |
Referenced by sched_setscheduler_ex().
int sched_setscheduler_ex | ( | pid_t | pid, |
int | policy, | ||
const struct sched_param_ex * | param_ex | ||
) |
Set extended scheduling policy of a process
This service is an extended version of the sched_setscheduler() service, which supports Cobalt-specific and/or additional scheduling policies, not available with the host Linux environment. It sets the scheduling policy of the Cobalt process/thread identified by pid to the value policy, and the scheduling parameters (e.g. its priority) to the value pointed to by par.
If the current Linux thread ID or zero is passed (see gettid(2)), this service may turn the current regular POSIX thread into a Cobalt thread.
pid | target process/thread. If zero, the current thread is assumed. |
policy | scheduling policy, one of SCHED_WEAK, SCHED_FIFO, SCHED_COBALT, SCHED_RR, SCHED_SPORADIC, SCHED_TP, SCHED_QUOTA or SCHED_NORMAL; |
param_ex | address of scheduling parameters. As a special exception, a negative sched_priority value is interpreted as if SCHED_WEAK was given in policy, using the absolute value of this parameter as the weak priority level. |
When CONFIG_XENO_OPT_SCHED_WEAK is enabled, SCHED_WEAK exhibits priority levels in the [0..99] range (inclusive). Otherwise, sched_priority must be zero for the SCHED_WEAK policy.
See sched_setscheduler().
References sched_setscheduler().
int sched_yield | ( | void | ) |
Yield the processor.
This function move the current thread at the end of its priority group.
0 |