Skip to main content

Sched

Functions

sched_get_priority_max(int policy)#

int sched_get_priority_max (int policy)

Type: int

Parameters:

  • int policy

Details#

This function gets the maximum priority for policy.

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: policy is not SCHED_RR, SCHED_FIFO, or SCHED_OTHER

sched_get_priority_min(int policy)#

int sched_get_priority_min (int policy)

Type: int

Parameters:

  • int policy

Details#

This function gets the minimum priority for policy.

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: policy is not SCHED_RR, SCHED_FIFO, or SCHED_OTHER

sched_getparam(pid_t pid, struct sched_param *param)#

int sched_getparam (pid_t pid, struct sched_param *param)

Type: int

Parameters:

  • pid_t pid
  • struct sched_param * param

Details#

This function gets the scheduling parameter (priority) for pid.

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: policy is not SCHED_RR, SCHED_FIFO, or SCHED_OTHER
  • ESRCH: pid is not a valid process

sched_getscheduler(pid_t pid)#

int sched_getscheduler (pid_t pid)

Type: int

Parameters:

  • pid_t pid

Details#

This function gets the scheduling policy.

Returns:

The scheduling policy on success or -1 with errno (see Errno) set to:

  • ESRCH: pid is not a valid process

sched_rr_get_interval(pid_t pid, struct timespec *ts)#

int sched_rr_get_interval (pid_t pid, struct timespec *ts)

Type: int

Parameters:

  • pid_t pid
  • struct timespec * ts

Details#

This function gets the round robin interval for pid.

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: ts is NULL
  • ESRCH: pid is not a valid process

sched_setparam(pid_t pid, const struct sched_param *param)#

int sched_setparam (pid_t pid, const struct sched_param *param)

Type: int

Parameters:

  • pid_t pid
  • const struct sched_param * param

Details#

This function sets the process's scheduling paramater (priority).

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • ESRCH: pid is not a valid process
  • EPERM: the calling process does not have permission to change the scheduling parameters

sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)#

int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param)

Type: int

Parameters:

  • pid_t pid
  • int policy
  • const struct sched_param * param

Details#

This function sets the scheduler policy and parameter (priority) for the process.

Returns:

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: policy is not SCHED_RR, SCHED_FIFO, or SCHED_OTHER
  • EPERM: the calling process does not have permission to change the scheduling parameters
  • ESRCH: pid is not a valid process

sched_yield()#

int sched_yield ()

Type: int

Details#

This function causes the calling thread to yield the processor. The context is switched to the next active task. If no tasks are active, the CPU idles.

Returns:

Zero