Microsoft KB Archive/94996

{|
 * width="100%"|

INFO: VirtualLock Only Locks Pages into Working Set

 * }

Q94996

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * Microsoft Windows NT Server versions 3.1, 3.5, 3.51, 4.0
 * Microsoft Windows NT Workstation versions 3.1, 3.5, 3.51, 4.0
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Professional

-

SUMMARY
VirtualLock causes pages to be locked into an application's working set (virtual memory); it does not lock them absolutely into physical memory. VirtualLock essentially means &quot;this page is always part of the process's working set.&quot;

The system is free to swap out any virtually locked pages if it swaps out the whole process. And when the system swaps the process back in, the virtually locked pages (similar to any virtual pages) may end up residing in different real pages.

It is wise to use VirtualLock very sparingly because it reduces the flexibility of the system.

Depending upon memory demands on the system, the memory manager may vary the number of pages a process can lock. Under typical conditions you can expect to be able to VirtualLock approximately 28 to 32 pages.

In Windows NT 3.5, you can use SetProcessWorkingSetSize to increase the size of the working set, and therefore increase the number of pages that VirtualLock can lock.

Additional query words: 3.10 3.50 kbprg

Keywords : kbAPI kbKernBase kbGrpDSKernBase

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API