Sets kernel thread scheduling parameters.
#include <sys/thread.h> #include <sys/sched.h>
int thread_setsched (tid, priority, policy) tid_t tid; int priority; int policy;
The thread_setsched subroutine sets the scheduling parameters for a kernel thread. This includes both the priority and the scheduling policy, which are specified in the priority and policy parameters. The calling and the target thread must be in the same process.
When setting the scheduling policy to SCHED_OTHER, the system chooses the priority; the priority parameter is ignored. The only way to influence the priority of a thread using the default AIX scheduling policy is to chnage the process nice value.
The calling thread must belong to a process with root authority to change the scheduling policy of a thread to either SCHED_FIFO or SCHED_RR.
The thread_setsched kernel service can be called from the process environment only.
Upon successful completion, 0 is returned. Otherwise, -1 is returned, and the error code can be checked by calling the getuerror kernel service.
EINVAL | The priority or policy parameters are not valid. |
EPERM | The calling kernel thread does not have sufficient privilege to perform the operation. |
ESRCH | The kernel thread tid does not exist. |
The thread_setsched kernel service is part of the Base Operating System (BOS) Runtime.
The thread_create kernel service.
Process and Exception Management Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.