Execution Scheduling [POSIX Section 13]

Functions Implemented

int sched_yield(void); 
int sched_get_priority_max(int policy); 
int sched_get_priority_min(int policy); 
int sched_rr_get_interval(pid_t pid, struct timespec *t); 
int pthread_attr_setscope(pthread_attr_t *attr, int scope); 
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope); 
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit); 
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit); 
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); 
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);
int pthread_attr_setschedparam( pthread_attr_t *attr, const struct sched_param *param); 
int pthread_attr_getschedparam( const pthread_attr_t *attr,
	                        struct sched_param *param); 
int pthread_setschedparam(pthread_t thread, int policy,
	                  const struct sched_param *param); 
int pthread_getschedparam(pthread_t thread, int *policy,
	                  struct sched_param *param); 
int pthread_mutexattr_setprotocol( pthread_mutexattr_t *attr,
                                   int protocol);
int pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr,
                                   int *protocol); 
int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr,
                                      int prioceiling); 
int pthread_mutexattr_getprioceiling( pthread_mutexattr_t *attr,
	                              int *prioceiling);
int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
	                          int prioceiling,
	                          int *old_ceiling); 
int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
                                  int *prioceiling);

Functions Omitted

int sched_setparam(pid_t pid, const struct sched_param *param); 
int sched_getparam(pid_t pid, struct sched_param *param); 
int sched_setscheduler(pid_t pid, int policy,
	               const struct sched_param *param); 
int sched_getscheduler(pid_t pid);


  • The functions sched_setparam(), sched_getparam(), sched_setscheduler() and sched_getscheduler() are present but always return an error.

  • The scheduler policy SCHED_OTHER is equivalent to SCHED_RR.

  • Only PTHREAD_SCOPE_SYSTEM is supported as a contentionscope attribute.

  • The default thread scheduling attributes are:

    	  contentionscope          PTHREAD_SCOPE_SYSTEM
    	  inheritsched             PTHREAD_INHERIT_SCHED
    	  schedpolicy              SCHED_OTHER
    	  schedparam.sched	   0

  • Mutex priority inversion protection is controlled by a number of kernel configuration options. If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT is defined then {_POSIX_THREAD_PRIO_INHERIT} will be defined and PTHREAD_PRIO_INHERIT may be set as the protocol in a pthread_mutexattr_t object. If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING is defined then {_POSIX_THREAD_PRIO_PROTECT} will be defined and PTHREAD_PRIO_PROTECT may be set as the protocol in a pthread_mutexattr_t object.

  • The default attribute values set by pthread_mutexattr_init() is to set the protocol attribute to PTHREAD_PRIO_NONE and the prioceiling attribute to zero.

Documentation license for this page: Open Publication License