[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

thread_setsched Kernel Service

Purpose

Sets kernel thread scheduling parameters.

Syntax

#include <sys/thread.h>
#include <sys/sched.h>
int thread_setsched (tid, priority, policy)
tid_t tid;
int priority;
int policy;

Parameters

tid Specifies the kernel thread.
priority Specifies the priority. It must be in the range from 0 to PRI_LOW; 0 is the most favored priority.
policy Specifies the scheduling policy. It must have one of the following values:
SCHED_FIFO Denotes fixed priority first-in first-out scheduling.
SCHED_RR Denotes fixed priority round-robin scheduling.
SCHED_OTHER Denotes the default AIX scheduling policy.

Description

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.

Execution Environment

The thread_setsched kernel service can be called from the process environment only.

Return Values

Upon successful completion, 0 is returned. Otherwise, -1 is returned, and the error code can be checked by calling the getuerror kernel service.

Error Codes

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.

Implementation Specifics

The thread_setsched kernel service is part of the Base Operating System (BOS) Runtime.

Related Information

The thread_create kernel service.

Process and Exception Management Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]