The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/man/thread_set_policy.man

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 .\" 
    2 .\" Mach Operating System
    3 .\" Copyright (c) 1993 Carnegie Mellon University
    4 .\" All Rights Reserved.
    5 .\" 
    6 .\" Permission to use, copy, modify and distribute this software and its
    7 .\" documentation is hereby granted, provided that both the copyright
    8 .\" notice and this permission notice appear in all copies of the
    9 .\" software, derivative works or modified versions, and any portions
   10 .\" thereof, and that both notices appear in supporting documentation.
   11 .\" 
   12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13 .\" CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15 .\" 
   16 .\" Carnegie Mellon requests users of this software to return to
   17 .\" 
   18 .\"  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19 .\"  School of Computer Science
   20 .\"  Carnegie Mellon University
   21 .\"  Pittsburgh PA 15213-3890
   22 .\" 
   23 .\" any improvements or extensions that they make and grant Carnegie Mellon
   24 .\" the rights to redistribute these changes.
   25 .\" 
   26 .\" 
   27 .\" HISTORY
   28 .\" $Log:       thread_set_policy.man,v $
   29 .\" Revision 2.2  93/12/07  13:59:11  dbg
   30 .\"     Created.
   31 .\" 
   32 .\" 
   33 .TH thread_set_policy 2 9/22/93
   34 .CM 4
   35 .SH NAME
   36 .nf
   37 thread_set_policy  \-  set scheduling policy for a thread
   38 .SH SYNOPSIS
   39 .nf
   40 .ft B
   41 #include <mach.h>
   42 
   43 .nf
   44 .ft B
   45 kern_return_t thread_set_policy(
   46         thread_t        thread,
   47         processor_set_t pset,
   48         int             policy,
   49         policy_param_t  param,
   50         natural_t       param_count);
   51 
   52 
   53 .fi
   54 .ft P
   55 .SH ARGUMENTS
   56 .TP 15
   57 .B
   58 thread
   59 Thread to set policy for.
   60 .TP 15
   61 .B
   62 pset
   63 The control port for the processor set to which thread is assigned.
   64 .TP 15
   65 .B
   66 policy
   67 Policy to set.
   68 .TP 15
   69 .B
   70 param[param_count]
   71 Policy-specific parameters.
   72 
   73 .SH DESCRIPTION
   74 .B thread_set_policy
   75 changes the scheduling policy for 
   76 .B thread
   77 to 
   78 .B policy.
   79 
   80 .B param
   81 is policy-dependent scheduling information.  The base system supports
   82 three scheduling policies: 
   83 .B POLICY_FIXEDPRI,
   84 .B POLICY_TIMESHARE
   85 and 
   86 .B POLICY_BACKGROUND,
   87 defined in <mach/policy.h>; this file is included by mach.h.  Fixed-priority
   88 threads are chosen to run before any timesharing threads; in turn,
   89 timesharing threads are chosen before any background threads.  Within
   90 each policy, the policy parameters for each thread determines which
   91 thread is chosen to run.
   92 
   93 .B POLICY_BACKGROUND
   94 
   95 Background threads run only if no other threads in the system are runnable.
   96 They are scheduled in a round-robin fashion.
   97 .B param
   98 is not used.
   99 
  100 .B POLICY_TIMESHARE
  101 
  102 Timesharing threads have a base priority value ranging from 0 (highest)
  103 to 31 (lowest).  The actual priority used for scheduling threads is
  104 the sum of the base priority value and an increment (toward lower priority)
  105 derived from the thread's run time.
  106 .B param
  107 is the base priority value for the thread.
  108 
  109 .B POLICY_FIXEDPRI
  110 
  111 Fixed-priority threads run in order of their priorities, which range
  112 from 0 (highest) to 31 (lowest).  A thread may also be designated
  113 as round-robin or first-in-first-out.  The processor multiplexes between
  114 round-robin threads of equal priority at each quantum expiration.  In
  115 contrast, a first-in-first-out thread will run until it blocks, if no
  116 higher-priority threads are runnable.
  117 
  118 .B param
  119 has two components:  the thread's priority, and whether the thread
  120 is round-robin (TRUE) or first-in-first-out (FALSE).
  121 
  122 Processor sets may restrict the allowed policies, so this call will fail
  123 if the processor set to which 
  124 .B thread
  125 is currently assigned does not permit 
  126 .B policy.
  127 Moreover, the thread's processor set control port
  128 must be presented to allow changing the thread's policy, since
  129 a malfunctioning fixed-priority thread at priority 0 would prevent
  130 all other threads in the system from running.
  131 
  132 .SH DIAGNOSTICS
  133 .TP 25
  134 KERN_SUCCESS
  135 The call succeeded.
  136 .TP 25
  137 KERN_INVALID_ARGUMENT
  138 .B thread
  139 is not a thread, or
  140 .B policy
  141 is not a recognized policy, or
  142 .B pset
  143 is not the thread's current processor set.
  144 .TP 25
  145 KERN_FAILURE
  146 The processor set to which 
  147 .B thread
  148 is currently assigned does not permit 
  149 .B policy.
  150 
  151 .SH BUGS
  152 Availability limited.
  153 
  154 .SH SEE ALSO
  155 .B task_set_default_policy, processor_set_policy_add, host_info
  156 
  157 
  158 

Cache object: 3e38e4cd07d09d1bf2b151708394f3ef


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.