RTEMS 6.1-rc4
Loading...
Searching...
No Matches
priority.h
Go to the documentation of this file.
1
9/*-
10 * SPDX-License-Identifier: BSD-4-Clause
11 *
12 * Copyright (c) 1994, Henrik Vestergaard Draboel
13 * All rights reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * 3. All advertising materials mentioning features or use of this software
24 * must display the following acknowledgement:
25 * This product includes software developed by Henrik Vestergaard Draboel.
26 * 4. The name of the author may not be used to endorse or promote products
27 * derived from this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * $FreeBSD$
42 */
43
44#ifndef _SYS_PRIORITY_H_
45#define _SYS_PRIORITY_H_
46
47/*
48 * Process priority specifications.
49 */
50
51/*
52 * Priority classes.
53 */
54
55#define PRI_ITHD 1 /* Interrupt thread. */
56#define PRI_REALTIME 2 /* Real time process. */
57#define PRI_TIMESHARE 3 /* Time sharing process. */
58#define PRI_IDLE 4 /* Idle process. */
59
60/*
61 * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
62 * are insignificant. Ranges are as follows:
63 *
64 * Interrupt threads: 0 - 47
65 * Realtime user threads: 48 - 79
66 * Top half kernel threads: 80 - 119
67 * Time sharing user threads: 120 - 223
68 * Idle user threads: 224 - 255
69 *
70 * XXX If/When the specific interrupt thread and top half thread ranges
71 * disappear, a larger range can be used for user processes.
72 */
73
74#define PRI_MIN (0) /* Highest priority. */
75#define PRI_MAX (255) /* Lowest priority. */
76
77#define PRI_MIN_ITHD (PRI_MIN)
78#define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1)
79
80#define PI_REALTIME (PRI_MIN_ITHD + 0)
81#define PI_AV (PRI_MIN_ITHD + 4)
82#define PI_NET (PRI_MIN_ITHD + 8)
83#define PI_DISK (PRI_MIN_ITHD + 12)
84#define PI_TTY (PRI_MIN_ITHD + 16)
85#define PI_DULL (PRI_MIN_ITHD + 20)
86#define PI_SOFT (PRI_MIN_ITHD + 24)
87#define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ)
88
89#define PRI_MIN_REALTIME (48)
90#define PRI_MAX_REALTIME (PRI_MIN_KERN - 1)
91
92#define PRI_MIN_KERN (80)
93#define PRI_MAX_KERN (PRI_MIN_TIMESHARE - 1)
94
95#define PSWP (PRI_MIN_KERN + 0)
96#define PVM (PRI_MIN_KERN + 4)
97#define PINOD (PRI_MIN_KERN + 8)
98#define PRIBIO (PRI_MIN_KERN + 12)
99#define PVFS (PRI_MIN_KERN + 16)
100#define PZERO (PRI_MIN_KERN + 20)
101#define PSOCK (PRI_MIN_KERN + 24)
102#define PWAIT (PRI_MIN_KERN + 28)
103#define PLOCK (PRI_MIN_KERN + 32)
104#define PPAUSE (PRI_MIN_KERN + 36)
105
106#define PRI_MIN_TIMESHARE (120)
107#define PRI_MAX_TIMESHARE (PRI_MIN_IDLE - 1)
108
109#define PUSER (PRI_MIN_TIMESHARE)
110
111#define PRI_MIN_IDLE (224)
112#define PRI_MAX_IDLE (PRI_MAX)
113
114#ifdef _KERNEL
115/* Other arguments for kern_yield(9). */
116#define PRI_USER -2 /* Change to current user priority. */
117#define PRI_UNCHANGED -1 /* Do not change priority. */
118#endif
119
120#endif /* !_SYS_PRIORITY_H_ */