网站首页  词典首页

请输入您要查询的函数:

 

术语 getpriorityclass
释义 GetPriorityClass
语法:
C++
DWORD WINAPI GetPriorityClass(
__in HANDLE hProcess
);
GetPriorityClass功能
检索指定的进程的优先级。此值,加上过程的每一个线程的优先级值,确定每个线程的基本优先级的Level。
参数
hProcess [in]
句柄的进程。
句柄必须有PROCESS_QUERY_INFORMATION或PROCESS_QUERY_LIMITED_INFORMATION访问权限。有关更多信息,请参见过程的安全性和访问权限。
Windows Server 2003和Windows XP/2000操作系统:在处理必须有PROCESS_QUERY_INFORMATION访问权。
返回值
如果函数成功,返回值是指定的进程优先级。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
该进程的优先级是下列值之一。
返回代码/ valueDescription
ABOVE_NORMAL_PRIORITY_CLASS
0x00008000Process已超过NORMAL_PRIORITY_CLASS,但低于HIGH_PRIORITY_CLASS优先。
BELOW_NORMAL_PRIORITY_CLASS
0x00004000Process已超过IDLE_PRIORITY_CLASS但低于NORMAL_PRIORITY_CLASS优先。
HIGH_PRIORITY_CLASS
0x00000080Process的执行时间,必须立即执行它正常运行的重要任务。一个高优先级进程的线程优先于正常或空闲优先级进程的线程。一个例子是任务列表,它必须迅速作出反应时,由用户要求,不论在操作系统上的负载。使用时小心使用高优先级,因为高优先级的CPU受限的应用程序可以使用几乎所有可用的周期。
IDLE_PRIORITY_CLASS
0x00000040Process线程运行的只有当系统处于空闲状态,并以任何在较高优先级的线程正在运行的进程抢占。一个例子是一个屏幕保护程序。空闲优先级继承了子进程。
NORMAL_PRIORITY_CLASS
0x00000020Process没有特别安排的需要。
REALTIME_PRIORITY_CLASS
0x00000100Process具有最高的优先事项。一个实时优先级进程的线程抢占了所有其他进程线程包括操作系统,程序执行重要任务。例如,一个实时的过程,比一个很短的时间间隔执行可能会导致更多的磁盘高速缓存不刷新或导致鼠标不响应。
备注
每个线程都有一个基本优先级的线程的优先级值和其进程的优先级确定。操作系统使用的所有可执行线程的基本优先级的Level,以确定哪个线程获取未来的CPU时间片。线程定于1轮在每个优先级循环方式,只有当有更高层次上没有可执行线程将安排在一个较低的Level,线程发生。
对于一个表,显示了每个优先级和线程的优先级值优先级相结合的基础,看到SetPriorityClass功能。
优先级是维护行政,使所有进程有一个优先级,可以查询。
实例
有关示例,请参阅以快照和浏览过程。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
GetThreadPriority
进程和线程函数
过程
调度优先级
SetPriorityClass
SetThreadPriority
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetPriorityClass Function
Retrieves the priority class for the specified process. This value, together with the priority value of each thread of the process, determines each thread's base priority level.
Syntax
C++
DWORD WINAPI GetPriorityClass(
__in HANDLE hProcess
);
Parameters
hProcess [in]
A handle to the process.
The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights .
Windows Server 2003 and Windows XP/2000: The handle must have the PROCESS_QUERY_INFORMATION access right.
Return Value
If the function succeeds, the return value is the priority class of the specified process.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
The process's priority class is one of the following values.
Return code/valueDescription
ABOVE_NORMAL_PRIORITY_CLASS
0x00008000Process that has priority above NORMAL_PRIORITY_CLASS but below HIGH_PRIORITY_CLASS.
BELOW_NORMAL_PRIORITY_CLASS
0x00004000Process that has priority above IDLE_PRIORITY_CLASS but below NORMAL_PRIORITY_CLASS.
HIGH_PRIORITY_CLASS
0x00000080Process that performs time-critical tasks that must be executed immediately for it to run correctly. The threads of a high-priority class process preempt the threads of normal or idle priority class processes. An example is the Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class CPU-bound application can use nearly all available cycles.
IDLE_PRIORITY_CLASS
0x00000040Process whose threads run only when the system is idle and are preempted by the threads of any process running in a higher priority class. An example is a screen saver. The idle priority class is inherited by child processes.
NORMAL_PRIORITY_CLASS
0x00000020Process with no special scheduling needs.
REALTIME_PRIORITY_CLASS
0x00000100Process that has the highest possible priority. The threads of a real-time priority class process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive.

Remarks
Every thread has a base priority level determined by the thread's priority value and the priority class of its process. The operating system uses the base priority level of all executable threads to determine which thread gets the next slice of CPU time. Threads are scheduled in a round-robin fashion at each priority level, and only when there are no executable threads at a higher level will scheduling of threads at a lower level take place.
For a table that shows the base priority levels for each combination of priority class and thread priority value, see the SetPriorityClass function.
Priority class is maintained by the executive, so all processes have a priority class that can be queried.
Examples
For an example, see Taking a Snapshot and Viewing Processes .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
GetThreadPriority
Process and Thread Functions
Processes
Scheduling Priorities
SetPriorityClass
SetThreadPriority
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms683211(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:15