网站首页  词典首页

请输入您要查询的函数:

 

术语 setprocessworkingsetsize
释义 SetProcessWorkingSetSize
语法:
C++
BOOL WINAPI SetProcessWorkingSetSize(
__in HANDLE hProcess,
__in SIZE_T dwMinimumWorkingSetSize,
__in SIZE_T dwMaximumWorkingSetSize
);
SetProcessWorkingSetSize函数
设置最小和最大工作集大小为指定的进程。
参数
hProcess [in]
句柄的过程,其工作集大小要设置。
句柄必须有PROCESS_SET_QUOTA访问权限。有关更多信息,请参见过程的安全性和访问权限。
dwMinimumWorkingSetSize [in]
最低工作集的进程大小,以字节为单位。虚拟内存管理器试图至少保持这一进程的内存居民每当进程处于活动状态。
此参数必须大于零,但小于或等于最大工作集大小。默认大小为50页(例如,这是204,800字节的系统上的4K页大小)。如果该值大于零,但超过20页,最低值设置为20页以下。
如果同时dwMinimumWorkingSetSize和dwMaximumWorkingSetSize有值(SIZE_T)-1,该函数删除尽可能多的网页从工作的指明工序集。
dwMaximumWorkingSetSize [in]
最高工作集的进程大小,以字节为单位。该企图管理虚拟内存让没有比这个过程中更多的内存居民每当进程处于活动状态和可用内存不足。
此参数必须大于或等于13页(例如,在系统53248的4K页大小),低于全系统最大(可用页面数减去512页)。默认大小为345页(例如,这是1413120字节的系统上的4K页大小)。
如果同时dwMinimumWorkingSetSize和dwMaximumWorkingSetSize有值(SIZE_T)-1,该函数删除尽可能多的网页从工作的指明工序集。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。调用GetLastError函数获取扩展的错误信息。
备注
在工作过程集是在进程目前驻留在物理内存的虚拟地址空间内存页集。这些网页可在申请使用没有触发页面错误。如需有关页面错误信息,请参阅工作集。最小和最大工作集大小影响的虚拟内存分页行为的过程。
工作集指定的过程可以通过指定的值(SIZE_T)为最小和最大工作集大小-1空。此删除尽可能多页的工作集。该EmptyWorkingSet功能也可用于这一目的。
如果任何一方dwMinimumWorkingSetSize或dwMaximumWorkingSetSize大于进程的当前工作集大小的值,指定的进程必须具有SE_INC_WORKING_SET_NAME特权。所有用户通常有这种特权。如需有关安全权限的信息,请参阅特权。
Windows Server 2003和Windows XP/2000操作系统:指定的进程必须具有SE_INC_BASE_PRIORITY_NAME特权。在Administrators和Power Users组的用户通常有此特权。
在操作系统上设置分配工作,先到先得,先到先得大小。例如,如果一个应用程序成功地设置为40兆字节的最低工作集大小在64兆系统,和第二个应用程序请求一个40兆的工作集大小,操作系统否认第二个应用程序的要求。
使用SetProcessWorkingSetSize函数来设置应用程序的最小和最大工作集大小并不能保证所要求的内存将被保留,或者它会时刻保持高度的居民。当应用程序空闲,或低内存的情况会导致对内存的需求,操作系统可以减少应用程序的工作集。一个应用程序可以使用VirtualLock功能锁定应用程序的内存中的虚拟地址空间范围,但是,这有可能降低系统的性能。
当您增加工作集的应用程序的大小,您正在远离系统其他部分的物理内存。这可以降低其他应用程序的性能,整个系统。它也导致行动失败,需要物理内存在场(例如,创建进程,线程和内核池)。因此,您必须使用SetProcessWorkingSetSize函数小心。您必须始终考虑到整个系统的性能当您设计的应用程序。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
GetProcessWorkingSetSize
进程和线程函数
工艺工作集
过程
SetProcessWorkingSetSizeEx
VirtualLock
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==SetProcessWorkingSetSize Function
Sets the minimum and maximum working set sizes for the specified process.
Syntax
C++
BOOL WINAPI SetProcessWorkingSetSize(
__in HANDLE hProcess,
__in SIZE_T dwMinimumWorkingSetSize,
__in SIZE_T dwMaximumWorkingSetSize
);
Parameters
hProcess [in]
A handle to the process whose working set sizes is to be set.
The handle must have the PROCESS_SET_QUOTA access right. For more information, see Process Security and Access Rights .
dwMinimumWorkingSetSize [in]
The minimum working set size for the process, in bytes. The virtual memory manager attempts to keep at least this much memory resident in the process whenever the process is active.
This parameter must be greater than zero but less than or equal to the maximum working set size. The default size is 50 pages (for example, this is 204,800 bytes on systems with a 4K page size). If the value is greater than zero but less than 20 pages, the minimum value is set to 20 pages.
If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value (SIZE_T)–1, the function removes as many pages as possible from the working set of the specified process.
dwMaximumWorkingSetSize [in]
The maximum working set size for the process, in bytes. The virtual memory manager attempts to keep no more than this much memory resident in the process whenever the process is active and available memory is low.
This parameter must be greater than or equal to 13 pages (for example, 53,248 on systems with a 4K page size), and less than the system-wide maximum (number of available pages minus 512 pages). The default size is 345 pages (for example, this is 1,413,120 bytes on systems with a 4K page size).
If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value (SIZE_T)–1, the function removes as many pages as possible from the working set of the specified process.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. Call GetLastError to obtain extended error information.
Remarks
The working set of a process is the set of memory pages in the virtual address space of the process that are currently resident in physical memory. These pages are available for an application to use without triggering a page fault. For more information about page faults, see Working Set . The minimum and maximum working set sizes affect the virtual memory paging behavior of a process.
The working set of the specified process can be emptied by specifying the value (SIZE_T)–1 for both the minimum and maximum working set sizes. This removes as many pages as possible from the working set. The EmptyWorkingSet function can also be used for this purpose.
If the values of either dwMinimumWorkingSetSize or dwMaximumWorkingSetSize are greater than the process' current working set sizes, the specified process must have the SE_INC_WORKING_SET_NAME privilege. All users generally have this privilege. For more information about security privileges, see Privileges .
Windows Server 2003 and Windows XP/2000: The specified process must have the SE_INC_BASE_PRIORITY_NAME privilege. Users in the Administrators and Power Users groups generally have this privilege.
The operating system allocates working set sizes on a first-come, first-served basis. For example, if an application successfully sets 40 megabytes as its minimum working set size on a 64-megabyte system, and a second application requests a 40-megabyte working set size, the operating system denies the second application's request.
Using the SetProcessWorkingSetSize function to set an application's minimum and maximum working set sizes does not guarantee that the requested memory will be reserved, or that it will remain resident at all times. When the application is idle, or a low-memory situation causes a demand for memory, the operating system can reduce the application's working set. An application can use the VirtualLock function to lock ranges of the application's virtual address space in memory; however, that can potentially degrade the performance of the system.
When you increase the working set size of an application, you are taking away physical memory from the rest of the system. This can degrade the performance of other applications and the system as a whole. It can also lead to failures of operations that require physical memory to be present (for example, creating processes, threads, and kernel pool). Thus, you must use the SetProcessWorkingSetSize function carefully. You must always consider the performance of the whole system when you are designing an application.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
GetProcessWorkingSetSize
Process and Thread Functions
Process Working Set
Processes
SetProcessWorkingSetSizeEx
VirtualLock
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms686234(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:18:51