1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 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_priority.man,v $
29 .\" Revision 2.4 91/05/14 17:14:19 mrt
30 .\" Correcting copyright
31 .\"
32 .\" Revision 2.3 91/02/14 14:15:25 mrt
33 .\" Changed to new Mach copyright
34 .\" [91/02/12 18:16:18 mrt]
35 .\"
36 .\" Revision 2.2 90/08/07 18:46:13 rpd
37 .\" Created.
38 .\"
39 .TH thread_priority 2 8/13/89
40 .CM 4
41 .SH NAME
42 .nf
43 thread_priority \- set scheduling priority for thread
44 thread_max_priority \- set max scheduling priority for thread
45 .SH SYNOPSIS
46 .nf
47 .ft B
48 #include <mach.h>
49
50 .nf
51 .ft B
52 kern_return_t thread_priority(thread, priority, set_max)
53 thread_t thread;
54 int priority;
55 boolean_t set_max
56
57
58 .fi
59 .ft P
60 .nf
61 .ft B
62 kern_return_t thread_max_priority(thread, processor_set, priority)
63 thread_t thread;
64 processor_set_t processor_set;
65 int priority;
66
67
68 .fi
69 .ft P
70 .SH ARGUMENTS
71 .TP 15
72 .B
73 thread
74 The thread whose priority is to be changed.
75 .TP 15
76 .B
77 priority
78 The new priority to change it to.
79 .TP 15
80 .B
81 set_max
82 Also set thread's maximum priority if TRUE.
83 .TP 15
84 .B
85 processor_set
86 The control port for the processor set to which the
87 thread is currently assigned.
88
89 .SH DESCRIPTION
90 Threads have three priorities associated with them by the system, a
91 .B priority
92 , a
93 .B maximum priority
94 , and a
95 .B scheduled priority.
96 The scheduled priority is used to make scheduling decisions about the
97 thread. It is determined from the priority by the policy (for timesharing,
98 this means adding an increment derived from cpu usage). The priority
99 can be set under user control, but may never exceed the maximum priority.
100 Changing the maximum priority requires presentation of the control port
101 for the thread's processor set; since the control port for the default
102 processor set is privileged, users cannot raise their maximum priority
103 to unfairly compete with other users on that set. Newly created threads
104 obtain their priority from their task and their max priority from the
105 thread.
106
107 .B thread_priority
108 changes the priority and optionally the maximum priority of
109 .B thread.
110 Priorities range from 0 to 31, where lower numbers denote higher
111 priorities. If the new priority is higher than the priority of the
112 current thread, preemption may occur as a result of this call.
113 The maximum priority of the thread is also set if
114 .B set_max
115 is TRUE. This call will fail if
116 .B priority
117 is greater than the current maximum priority of the thread. As a result,
118 this call can only lower the value of a thread's maximum priority.
119
120 .B thread_max_priority
121 changes the maximum priority of the thread. Because it requires
122 presentation of the corresponding processor set port, this call can reset
123 the maximum priority to any legal value.
124
125 .SH DIAGNOSTICS
126 .TP 25
127 KERN_SUCCESS
128 Operation completed successfully
129 .TP 25
130 KERN_INVALID_ARGUMENT
131 .B thread
132 is not a thread, or
133 .B processor_set
134 is not a control port for a processor set, or
135 .B priority
136 is out of range (not in 0..31).
137 .TP 25
138 KERN_FAILURE
139 The requested operation would violate the thread's
140 maximum priority
141 (thread_priority) or the thread is not assigned to the processor set
142 whose control port was presented.
143
144 .SH BUGS
145 Availability limited.
146
147 .SH SEE ALSO
148 .B thread_policy, task_priority, processor_set_priority
149
Cache object: 0049579441fd176475d110a422b20344
|