Cache Size

[Previous] [Next]

In the following sections, we'll explain how Windows 2000 computes the size of the system cache (both virtually and physically). As with most calculations related to memory management, the size of the system cache depends on a number of factors, including memory size and which version of Windows 2000 is running.

Cache Virtual Size

The virtual size of the system cache is a function of the amount of physical memory installed. The default size is 64 MB. If the system has more than 4032 pages (16 MB) of physical memory, the cache size is set to 128 MB plus 64 MB for each additional 4 MB of physical memory. Using this algorithm, the virtual size of the system cache for a computer with 64 MB of physical memory will be:

128 MB + (64 MB - 16 MB) / 4 MB * 64 MB = 896 MB

Table 11-1 shows the minimum and maximum virtual size of the system cache, along with the start and end addresses. If the system calculates a cache virtual size that is greater than 512 MB, the cache is assigned virtual memory from an additional address range known as cache extra memory.

Table 11-1 Size and Location of System Data Cache

Platform Address Range Minimum/MaximumVirtual Size
x86 2-GB system space 0xC1000000-E0FFFFFF, 0xA4000000-BFFFFFFF 64-960 MB
x86 1-GB system space 0xC1000000-DBFFFFFF 64-432 MB
x86 1-GB system space with Terminal Services 0xC1000000-DCFFFFFF 64-448 MB

Table 11-2 lists the system variables that contain the virtual size and address of the system cache.

Table 11-2 System Variables for the Virtual Size and Address of the System Cache

System Variable Description
MmSystemCacheStart Starting virtual address of cache
MmSystemCacheEnd Ending virtual address of cache
MiSystemCacheStartExtra Starting virtual address of cache extra memory if cache size > 512 MB
MiSystemCacheEndExtra Ending virtual address of cache extra memory if cache size > 512 MB
MmSizeOfSystemCacheInPages Maximum size of cache in pages

Cache Physical Size

As mentioned earlier, one of the key differences in the design of the Windows 2000 cache manager from that of other operating systems is the delegation of physical memory management to the global memory manager. Because of this, the existing code that handles working set expansion and trimming as well as manages the modified and standby list is also used to control the size of the system cache, dynamically balancing demands for physical memory between processes and the operating system.

The system cache doesn't have its own working set but rather shares a single system set that includes cache data, paged pool, pageable Ntoskrnl code, and pageable driver code. As explained in the section "System Working Set" in Chapter 7, this single working set is called internally the system cache working set even though the system cache is just one of the components that contribute to it. For the purposes of this book, we'll refer to this working set simply as the system working set.

You can examine the physical size of the system cache compared to that of the total system working set as well as page fault information on the system working set by examining the performance counters or system variables listed in Table 11-3.

Table 11-3 System Variables for the Physical Size of the System Cache and Page Fault Information

Performance Counter (in bytes) System Variable (in pages) Description
Memory: System Cache Resident Bytes MmSystemCachePage Physical memory consumed by the system cache.
Memory: Cache Bytes MmSystemCacheWs.WorkingSetSize Total size of the system working set (including the cache, paged pool, pageable code, and system mapped views). This is not the size of the cache (as the name implies)!
Memory: Cache Bytes Peak MmSystemCacheWs.Peak Peak system working set size.
Memory: Cache Faults/Sec MmSystemCacheWs.PageFaultCount Page faults in the system working set (not just the cache).

Most utilities that claim to display the size of the system cache (such as Task Manager, Pview, Pstat, Pmon, Perfmtr, and so on) in fact display the total system working set size, not just the cache size. The reason for this inaccuracy is that the performance counter Memory: Cache Bytes (see Table 11-3) returns the total system working set size, which includes the system cache, paged pool, pageable system code, and system mapped views, even though the name and explanatory text imply that it represents just the cache size. For example, if you start Task Manager (by pressing Ctrl+Shift+Esc) and click the Performance tab, the field named System Cache is actually the system working set size, as you can see in Figure 11-4.

click to view at full size.

Figure 11-4 The Windows 2000 Task Manager doesn't report the size of the system cache

A number of internal system variables control working set expansion and trimming, such as MmWorkingSetReductionMaxCacheWs, MmWorkingSetReductionMinCacheWs, MmWorkingSetVolReductionMaxCacheWs, and MmPeriodicAgressiveCacheWsMin. Although we don't cover these variables in detail in this book, in Chapter 7, we do describe the memory manager's general policies for working set management.

EXPERIMENT
Looking At the Cache's Working Set

The !filecache debugger command dumps information about the physical memory the cache is using, including the names of files mapped into virtual address control blocks (VACBs), where applicable, as you can see in the following output. (File system drivers cache metadata by using unnamed file streams.)

 kd> !filecache 3 ***** Dump file cache****** File Cache Information Current size 6344 kb Peak size 14440 kb Loading file cache database (131072 PTEs)... File cache PTEs loaded, loading PFNs... File cache has 278 valid pages File cache PFN data extracted Building kernel map Finished building kernel map Usage Summary (in Kb): Control Valid Standby Dirty Shared Locked PageTables name ff3f5908 20 0 0 0 0 0 No Name for File ff3a0328 8 0 0 0 0 0 No Name for File fe50ba68 72 0 0 0 0 0 No Name for File fe4edd68 4 0 0 0 0 0 No Name for File fe4edcc8 88 0 0 0 0 0 No Name for File fe4ed7e8 16 0 0 0 0 0 No Name for File ff457968 4 0 0 0 0 0 No Name for File ff422de8 4 0 0 0 0 0 No Name for File ff142208 4 0 0 0 0 0 mapped_file( ias.mdb ) ff163708 4 0 0 0 0 0 No Name for File ff1314c8 4 0 0 0 0 0 No Name for File ff0ec448 4 0 0 0 0 0 mapped_file( dnary.mdb ) ff0f23a8 4 0 0 0 0 0 No Name for File fe50bda8 4 0 0 0 0 0 No Name for File ff0691a8 4 0 0 0 0 0 No Name for File ff071b08 4 0 0 0 0 0 No Name for File ff068b28 4 0 0 0 0 0 No Name for File ff0564c8 4 0 0 0 0 0 No Name for File ff070c48 4 0 0 0 0 0 No Name for File ff018d08 4 0 0 0 0 0 No Name for File ff013d48 4 0 0 0 0 0 No Name for File ff0e5f08 4 0 0 0 0 0 No Name for File ff02a628 4 0 0 0 0 0 No Name for File ff0f0ba8 4 0 0 0 0 0 No Name for File ff0e8b28 4 0 0 0 0 0 No Name for File ff05a628 4 0 0 0 0 0 No Name for File ff104e08 8 0 0 0 0 0 No Name for File ff016328 4 0 0 0 0 0 No Name for File ff06da88 4 0 0 0 0 0 No Name for File ff2d2e28 692 0 0 0 0 0 mapped_file( ntoskrnl.pdb ) ff0afce8 4 0 0 0 0 0 No Name for File ff001ae8 12 0 0 0 0 0 No Name for File feffe308 4 0 0 0 0 0 No Name for File ff175508 12 0 0 0 0 0 No Name for File feffd328 12 0 0 0 0 0 No Name for File feffc408 4 0 0 0 0 0 mapped_file( mshtml.tlb ) fefed788 12 0 0 0 0 0 No Name for File feff9d28 4 0 0 0 0 0 mapped_file ( relationship[1].gif ) ff03dd08 4 0 0 0 0 0 mapped_file ( emotional[1].gif ) ff059828 4 0 0 0 0 0 mapped_file ( ADSAdClient31[1].htm ) fefe72e8 4 0 0 0 0 0 mapped_file ( comp_medicine[1].gif ) fefe9868 12 0 0 0 0 0 mapped_file ( ADSAdClient31[1].htm ) unable to get subsection fefe4d08 feffd8a8 8 0 0 0 0 0 mapped_file ( ADSAdClient31[1].htm ) fefef008 4 0 0 0 0 0 mapped_file ( 002924Z0001_LG[1].gif ) ff2f64e8 4 0 0 0 0 0 mapped_file( SOFTWARE.LOG ) 



Inside Microsoft Windows 2000
Inside Microsoft Windows 2000, Third Edition (Microsoft Programming Series)
ISBN: 0735610215
EAN: 2147483647
Year: 2000
Pages: 121

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net