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_disableis 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_SUCCESSif the operation was completed successfully and
KERN_INVALID_ARGUMENTif processor_set is not a processor set or policy is not a valid policy, or an attempt was made to disable timesharing.