您的位置:首页 > 其它

注意!GetThreadPriority的返回值不是系统的优先级值

2014-02-17 15:41 239 查看
GetThreadPriority的返回值
Return code/valueDescription
THREAD_PRIORITY_ABOVE_NORMAL1Priority 1 point above the priority class.
THREAD_PRIORITY_BELOW_NORMAL-1Priority 1 point below the priority class.
THREAD_PRIORITY_HIGHEST2Priority 2 points above the priority class.
THREAD_PRIORITY_IDLE-15Base priority of 1 for IDLE_PRIORITY_CLASS,

BELOW_NORMAL_PRIORITY_CLASS,

NORMAL_PRIORITY_CLASS,

ABOVE_NORMAL_PRIORITY_CLASS,

or HIGH_PRIORITY_CLASSprocesses,

and a base priority of 16 forREALTIME_PRIORITY_CLASS processes.
THREAD_PRIORITY_LOWEST-2Priority 2 points below the priority class.
THREAD_PRIORITY_NORMAL0Normal priority for the priority class.
THREAD_PRIORITY_TIME_CRITICAL15Base-priority level of 15 for IDLE_PRIORITY_CLASS,

BELOW_NORMAL_PRIORITY_CLASS,

NORMAL_PRIORITY_CLASS,ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASSprocesses,

and a base-priority level of 31 forREALTIME_PRIORITY_CLASS processes.
系统的优先级值
Process priority classThread priority levelBase priority
IDLE_PRIORITY_CLASSTHREAD_PRIORITY_IDLE1
THREAD_PRIORITY_LOWEST2
THREAD_PRIORITY_BELOW_NORMAL3
THREAD_PRIORITY_NORMAL4
THREAD_PRIORITY_ABOVE_NORMAL5
THREAD_PRIORITY_HIGHEST6
THREAD_PRIORITY_TIME_CRITICAL15
BELOW_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_IDLE1
THREAD_PRIORITY_LOWEST4
THREAD_PRIORITY_BELOW_NORMAL5
THREAD_PRIORITY_NORMAL6
THREAD_PRIORITY_ABOVE_NORMAL7
THREAD_PRIORITY_HIGHEST8
THREAD_PRIORITY_TIME_CRITICAL15
NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_IDLE1
THREAD_PRIORITY_LOWEST6
THREAD_PRIORITY_BELOW_NORMAL7
THREAD_PRIORITY_NORMAL8
THREAD_PRIORITY_ABOVE_NORMAL9
THREAD_PRIORITY_HIGHEST10
THREAD_PRIORITY_TIME_CRITICAL15
ABOVE_NORMAL_PRIORITY_CLASSTHREAD_PRIORITY_IDLE1
THREAD_PRIORITY_LOWEST8
THREAD_PRIORITY_BELOW_NORMAL9
THREAD_PRIORITY_NORMAL10
THREAD_PRIORITY_ABOVE_NORMAL11
THREAD_PRIORITY_HIGHEST12
THREAD_PRIORITY_TIME_CRITICAL15
HIGH_PRIORITY_CLASSTHREAD_PRIORITY_IDLE1
THREAD_PRIORITY_LOWEST11
THREAD_PRIORITY_BELOW_NORMAL12
THREAD_PRIORITY_NORMAL13
THREAD_PRIORITY_ABOVE_NORMAL14
THREAD_PRIORITY_HIGHEST15
THREAD_PRIORITY_TIME_CRITICAL15
REALTIME_PRIORITY_CLASSTHREAD_PRIORITY_IDLE16
THREAD_PRIORITY_LOWEST22
THREAD_PRIORITY_BELOW_NORMAL23
THREAD_PRIORITY_NORMAL24
THREAD_PRIORITY_ABOVE_NORMAL25
THREAD_PRIORITY_HIGHEST26
THREAD_PRIORITY_TIME_CRITICAL31
windows核心编程 5th 184页
Windows并没有提供返回线程优先级的函数。这一遗漏是Microsoft故意的。请记住Microsoft保留了任何时候改变调度算法的权利。我们设计的应用程序不应该了解调度算法具体细节。如果我们始终使用进程优先级类和相对线程优先级,那么我们的应用程序在现在和在操作系统的未来版本都可以运行得很好。

参考资源:

GetThreadPriority function

Scheduling Priorities
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: