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/sys/priority.h

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  * Copyright (c) 1994, Henrik Vestergaard Draboel
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by (name).
   16  * 4. The name of the author may not be used to endorse or promote products
   17  *    derived from this software without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  * $FreeBSD: src/sys/sys/priority.h,v 1.2.8.1 2005/01/31 23:26:57 imp Exp $
   32  */
   33 
   34 #ifndef _SYS_PRIORITY_H_
   35 #define _SYS_PRIORITY_H_
   36 
   37 /*
   38  * Process priority specifications.
   39  */
   40 
   41 /*
   42  * Priority classes.
   43  */
   44 
   45 #define PRI_ITHD                1       /* Interrupt thread. */
   46 #define PRI_REALTIME            2       /* Real time process. */
   47 #define PRI_TIMESHARE           3       /* Time sharing process. */
   48 #define PRI_IDLE                4       /* Idle process. */
   49 
   50 /*
   51  * PRI_FIFO is POSIX.1B SCHED_FIFO.
   52  */
   53 
   54 #define PRI_FIFO_BIT            8
   55 #define PRI_FIFO                (PRI_FIFO_BIT | PRI_REALTIME)
   56 
   57 #define PRI_BASE(P)             ((P) & ~PRI_FIFO_BIT)
   58 #define PRI_IS_REALTIME(P)      (PRI_BASE(P) == PRI_REALTIME)
   59 #define PRI_NEED_RR(P)          ((P) != PRI_FIFO)
   60 
   61 /*
   62  * Priorities.  Note that with 64 run queues, differences less than 4 are
   63  * insignificant.
   64  */
   65 
   66 /*
   67  * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
   68  * are insignificant.  Ranges are as follows:
   69  *
   70  * Interrupt threads:           0 - 63
   71  * Top half kernel threads:     64 - 127
   72  * Realtime user threads:       128 - 159
   73  * Time sharing user threads:   160 - 223
   74  * Idle user threads:           224 - 255
   75  *
   76  * XXX If/When the specific interrupt thread and top half thread ranges
   77  * disappear, a larger range can be used for user processes.
   78  */
   79 
   80 #define PRI_MIN                 (0)             /* Highest priority. */
   81 #define PRI_MAX                 (255)           /* Lowest priority. */
   82 
   83 #define PRI_MIN_ITHD            (PRI_MIN)
   84 #define PRI_MAX_ITHD            (PRI_MIN_KERN - 1)
   85 
   86 #define PI_REALTIME             (PRI_MIN_ITHD + 0)
   87 #define PI_AV                   (PRI_MIN_ITHD + 4)
   88 #define PI_TTYHIGH              (PRI_MIN_ITHD + 8)
   89 #define PI_TAPE                 (PRI_MIN_ITHD + 12)
   90 #define PI_NET                  (PRI_MIN_ITHD + 16)
   91 #define PI_DISK                 (PRI_MIN_ITHD + 20)
   92 #define PI_TTYLOW               (PRI_MIN_ITHD + 24)
   93 #define PI_DISKLOW              (PRI_MIN_ITHD + 28)
   94 #define PI_DULL                 (PRI_MIN_ITHD + 32)
   95 #define PI_SOFT                 (PRI_MIN_ITHD + 36)
   96 
   97 #define PRI_MIN_KERN            (64)
   98 #define PRI_MAX_KERN            (PRI_MIN_REALTIME - 1)
   99 
  100 #define PSWP                    (PRI_MIN_KERN + 0)
  101 #define PVM                     (PRI_MIN_KERN + 4)
  102 #define PINOD                   (PRI_MIN_KERN + 8)
  103 #define PRIBIO                  (PRI_MIN_KERN + 12)
  104 #define PVFS                    (PRI_MIN_KERN + 16)
  105 #define PZERO                   (PRI_MIN_KERN + 20)
  106 #define PSOCK                   (PRI_MIN_KERN + 24)
  107 #define PWAIT                   (PRI_MIN_KERN + 28)
  108 #define PCONFIG                 (PRI_MIN_KERN + 32)
  109 #define PLOCK                   (PRI_MIN_KERN + 36)
  110 #define PPAUSE                  (PRI_MIN_KERN + 40)
  111 
  112 #define PRI_MIN_REALTIME        (128)
  113 #define PRI_MAX_REALTIME        (PRI_MIN_TIMESHARE - 1)
  114 
  115 #define PRI_MIN_TIMESHARE       (160)
  116 #define PRI_MAX_TIMESHARE       (PRI_MIN_IDLE - 1)
  117 
  118 #define PUSER                   (PRI_MIN_TIMESHARE)
  119 
  120 #define PRI_MIN_IDLE            (224)
  121 #define PRI_MAX_IDLE            (PRI_MAX)
  122 
  123 struct priority {
  124         u_char  pri_class;      /* Scheduling class. */
  125         u_char  pri_level;      /* Normal priority level. */
  126         u_char  pri_native;     /* Priority before propogation. */
  127         u_char  pri_user;       /* User priority based on p_cpu and p_nice. */
  128 };
  129 
  130 #endif  /* !_SYS_PRIORITY_H_ */

Cache object: 31a7798f1e395e05c6a4461c72c8619e


[ 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.