![]() |
Xenomai POSIX skin supports the scheduling policies SCHED_FIFO, SCHED_RR and SCHED_OTHER.
The SCHED_OTHER policy is mainly useful for user-space non-realtime activities that need to synchronize with real-time activities.
The SCHED_RR policy is only effective if the time base is periodic (i.e. if configured with the compilation constant CONFIG_XENO_OPT_POSIX_PERIOD or the xeno_nucleus module parameter tick_arg set to a non null value). The SCHED_RR round-robin time slice is configured with the xeno_posix module parameter time_slice, as a count of system timer clock ticks.
The SCHED_SPORADIC policy is not supported.
The scheduling policy and priority of a thread is set when creating a thread, by using thread creation attributes (see pthread_attr_setinheritsched(), pthread_attr_setschedpolicy() and pthread_attr_setschedparam()), or when the thread is already running by using the service pthread_setschedparam().
Functions | |
int | sched_get_priority_min (int policy) |
Get minimum priority of the specified scheduling policy. | |
int | sched_get_priority_max (int policy) |
Get maximum priority of the specified scheduling policy. | |
int | sched_rr_get_interval (int pid, struct timespec *interval) |
Get the round-robin scheduling time slice. | |
int | pthread_getschedparam (pthread_t tid, int *pol, struct sched_param *par) |
Get the scheduling policy and parameters of the specified thread. | |
int | pthread_setschedparam (pthread_t tid, int pol, const struct sched_param *par) |
Set the scheduling policy and parameters of the specified thread. | |
int | sched_yield (void) |
Yield the processor. |
int pthread_getschedparam | ( | pthread_t | tid, | |
int * | pol, | |||
struct sched_param * | par | |||
) |
Get the scheduling policy and parameters of the specified thread.
This service returns, at the addresses pol and par, the current scheduling policy and scheduling parameters (i.e. priority) of the Xenomai POSIX skin thread tid. If this service is called from user-space and tid is not the identifier of a Xenomai POSIX skin thread, this service fallback to Linux regular pthread_getschedparam service.
tid | target thread; | |
pol | address where the scheduling policy of tid is stored on success; | |
par | address where the scheduling parameters of tid is stored on success. |
an error number if:
int pthread_setschedparam | ( | pthread_t | tid, | |
int | pol, | |||
const struct sched_param * | par | |||
) |
Set the scheduling policy and parameters of the specified thread.
This service set the scheduling policy of the Xenomai POSIX skin thread tid to the value pol, and its scheduling parameters (i.e. its priority) to the value pointed to by par.
When used in user-space, passing the current thread ID as tid argument, this service turns the current thread into a Xenomai POSIX skin thread. If tid is neither the identifier of the current thread nor the identifier of a Xenomai POSIX skin thread this service falls back to the regular pthread_setschedparam() service, hereby causing the current thread to switch to secondary mode if it is Xenomai thread.
tid | target thread; | |
pol | scheduling policy, one of SCHED_FIFO, SCHED_RR or SCHED_OTHER; | |
par | scheduling parameters address. |
an error number if:
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, one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER. |
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, one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER. |
0 | on success; | |
-1 | with errno set if:
|
int sched_rr_get_interval | ( | int | pid, | |
struct timespec * | interval | |||
) |
Get the round-robin scheduling time slice.
This service returns the time quantum used by Xenomai POSIX skin SCHED_RR scheduling policy.
In kernel-space, this service only works if pid is zero, in user-space, round-robin scheduling policy is not supported, and this service not implemented.
pid | must be zero; | |
interval | address where the round-robin scheduling time quantum will be returned on success. |
0 | on success; | |
-1 | with errno set if:
|
int sched_yield | ( | void | ) |
Yield the processor.
This function move the current thread at the end of its priority group.
0 |