Next: , Previous: Processor Set Priority, Up: Processor Set Interface

9.1.7 Processor Set Policy

— Function: kern_return_t processor_set_policy_enable (processor_set_t processor_set, int policy)
— Function: kern_return_t processor_set_policy_disable (processor_set_t processor_set, int policy, boolean_t change_threads)

Processor sets may restrict the scheduling policies to be used for threads assigned to them. These two calls provide the mechanism for designating permitted and forbidden policies. The current set of permitted policies can be obtained from processor_set_info. Timesharing may not be forbidden by any processor set. This is a compromise to reduce the complexity of the assign operation; any thread whose policy is forbidden by the target processor set has its policy reset to timesharing. If the change_threads argument to processor_set_policy_disable is true, threads currently assigned to this processor set and using the newly disabled policy will have their policy reset to timesharing.

mach/policy.h contains the allowed policies; it is included by mach.h. Not all policies (e.g. fixed priority) are supported by all systems.

This function returns KERN_SUCCESS if the operation was completed successfully and KERN_INVALID_ARGUMENT if processor_set is not a processor set or policy is not a valid policy, or an attempt was made to disable timesharing.