Previous: Hand-Off Scheduling, Up: Scheduling
The function
thread_policy
changes the scheduling policy for thread to policy.data is policy-dependent scheduling information. There are currently two supported policies:
POLICY_TIMESHARE
andPOLICY_FIXEDPRI
defined in mach/policy.h; this file is included by mach.h. data is meaningless for timesharing, but is the quantum to be used (in milliseconds) for the fixed priority policy. To be meaningful, this quantum must be a multiple of the basic system quantum (min_quantum) which can be obtained fromhost_info
. The system will always round up to the next multiple of the quantum.Processor sets may restrict the allowed policies, so this call will fail if the processor set to which thread is currently assigned does not permit policy.
The function returns
KERN_SUCCESS
if the call succeeded.KERN_INVALID_ARGUMENT
if thread is not a thread or policy is not a recognized policy, andKERN_FAILURE
if the processor set to which thread is currently assigned does not permit policy.