Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:14

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSAPISystemLibrary
0005  *
0006  * @brief This header file provides interfaces of the process priority support.
0007  */
0008 
0009 /*-
0010  * SPDX-License-Identifier: BSD-4-Clause
0011  *
0012  * Copyright (c) 1994, Henrik Vestergaard Draboel
0013  * All rights reserved.
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  * 3. All advertising materials mentioning features or use of this software
0024  *    must display the following acknowledgement:
0025  *      This product includes software developed by Henrik Vestergaard Draboel.
0026  * 4. The name of the author may not be used to endorse or promote products
0027  *    derived from this software without specific prior written permission.
0028  *
0029  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
0030  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0031  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0032  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
0033  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0034  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0035  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0036  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0037  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0038  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0039  * SUCH DAMAGE.
0040  *
0041  * $FreeBSD$
0042  */
0043 
0044 #ifndef _SYS_PRIORITY_H_
0045 #define _SYS_PRIORITY_H_
0046 
0047 /*
0048  * Process priority specifications.
0049  */
0050 
0051 /*
0052  * Priority classes.
0053  */
0054 
0055 #define PRI_ITHD                1       /* Interrupt thread. */
0056 #define PRI_REALTIME            2       /* Real time process. */
0057 #define PRI_TIMESHARE           3       /* Time sharing process. */
0058 #define PRI_IDLE                4       /* Idle process. */
0059 
0060 /*
0061  * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
0062  * are insignificant.  Ranges are as follows:
0063  *
0064  * Interrupt threads:           0 - 47
0065  * Realtime user threads:       48 - 79
0066  * Top half kernel threads:     80 - 119
0067  * Time sharing user threads:   120 - 223
0068  * Idle user threads:           224 - 255
0069  *
0070  * XXX If/When the specific interrupt thread and top half thread ranges
0071  * disappear, a larger range can be used for user processes.
0072  */
0073 
0074 #define PRI_MIN                 (0)             /* Highest priority. */
0075 #define PRI_MAX                 (255)           /* Lowest priority. */
0076 
0077 #define PRI_MIN_ITHD            (PRI_MIN)
0078 #define PRI_MAX_ITHD            (PRI_MIN_REALTIME - 1)
0079 
0080 #define PI_REALTIME             (PRI_MIN_ITHD + 0)
0081 #define PI_AV                   (PRI_MIN_ITHD + 4)
0082 #define PI_NET                  (PRI_MIN_ITHD + 8)
0083 #define PI_DISK                 (PRI_MIN_ITHD + 12)
0084 #define PI_TTY                  (PRI_MIN_ITHD + 16)
0085 #define PI_DULL                 (PRI_MIN_ITHD + 20)
0086 #define PI_SOFT                 (PRI_MIN_ITHD + 24)
0087 #define PI_SWI(x)               (PI_SOFT + (x) * RQ_PPQ)
0088 
0089 #define PRI_MIN_REALTIME        (48)
0090 #define PRI_MAX_REALTIME        (PRI_MIN_KERN - 1)
0091 
0092 #define PRI_MIN_KERN            (80)
0093 #define PRI_MAX_KERN            (PRI_MIN_TIMESHARE - 1)
0094 
0095 #define PSWP                    (PRI_MIN_KERN + 0)
0096 #define PVM                     (PRI_MIN_KERN + 4)
0097 #define PINOD                   (PRI_MIN_KERN + 8)
0098 #define PRIBIO                  (PRI_MIN_KERN + 12)
0099 #define PVFS                    (PRI_MIN_KERN + 16)
0100 #define PZERO                   (PRI_MIN_KERN + 20)
0101 #define PSOCK                   (PRI_MIN_KERN + 24)
0102 #define PWAIT                   (PRI_MIN_KERN + 28)
0103 #define PLOCK                   (PRI_MIN_KERN + 32)
0104 #define PPAUSE                  (PRI_MIN_KERN + 36)
0105 
0106 #define PRI_MIN_TIMESHARE       (120)
0107 #define PRI_MAX_TIMESHARE       (PRI_MIN_IDLE - 1)
0108 
0109 #define PUSER                   (PRI_MIN_TIMESHARE)
0110 
0111 #define PRI_MIN_IDLE            (224)
0112 #define PRI_MAX_IDLE            (PRI_MAX)
0113 
0114 #ifdef _KERNEL
0115 /* Other arguments for kern_yield(9). */
0116 #define PRI_USER        -2      /* Change to current user priority. */
0117 #define PRI_UNCHANGED   -1      /* Do not change priority. */
0118 #endif
0119 
0120 #endif  /* !_SYS_PRIORITY_H_ */