Difference between Task Manager and Performance Monitor (Working Set and private bytes)

Source: Internet
Author: User

Private bytes and virtual bytes can be used in Performance Monitor.ProgramMemory usage. in Task Manager, there are also memory usage and VM Size. however, after careful comparison, we will find that the memory usage does not correspond to private bytes, And the VM Size does not correspond to virtual bytes.

 

In fact,The memory usage in Task Manager corresponds to the working set, The VM Size corresponds to private bytes.So if you use task manager to observe memory usage, you should note this difference.

 

Working Set and private bytes

====================

An interesting question is: Working Set refers to the physical memory consumed by the current program, and private bytes refers to the commit memory. Why is the working set of some processes larger than private bytes? To answer this question, take a closer look at the definitions of the two:

    • "Working Set refers to the numbers of pages of virtual memory committed to a given process, both shared and private ."
    • "Private bytes is the current size, in bytes, of memory that this process has allocated that cannot be shared with other processes ."

Therefore, the working set contains the memory that may be shared by other programs, while the private bytes only includes the memory used by the current process.

 

DLL is a typical resource that may be shared by other programs. DLL loading uses a file image, so the physical memory containing the DLL can be simultaneously mapped to multiple processes. therefore, the DLL-loaded memory in the process can only be counted on the working set, but not on the private bytes.

 

When solving the memory problem, you do not need to consider the shared part.

When a process uses memory, the memory occupied by it is divided into two parts, one is the working set, and the other is the private byte minus the working set. the working set is stored in the physical memory, and the rest is the paging file, which exists on the disk.

 

Generally, adding the working set of all processes is larger than the physical memory on your machine. This is because shared resources (such as DLL) exist.

 

Definitions on technet

====================

Working Set

The set of memory pages (areas of memory allocated to a process) recently used by the threads in a process. if available memory on the server is abve a specified threshold, pages remain in the working set of a process even if they are not in use. when available memory falls below a specified threshold, pages are removed from the working set. if these pages are needed, they will be returned back to the working set before they leave main memory and are made available for other processes to use.

Private bytes

Displays the current number of bytes this process has allocated that cannot be shared with other processes.

Virtual bytes.

The current size, in bytes, of the virtual address space for this process. the virtual address space limit of a user mode process is 2 GB, unless 3 GB address space is enabled by using the/3 GB switch in Boot. ini.

 

More information about working set, virtual bytes, and private byte

====================

Original article:

Private bytesRefer to the amount of physical memory (RAM) that the process executable hasAsked-Not necessarily the amount it isActually using. Private bytes are "private" because they (usually) exclude memory-mapped Files (I. e. shared DLLs ). but-here's the catch-they don't necessarily exclude memoryAllocated by those files. So if your executable depends on any libraries-and almost every executable does-you cannot always tell whether a change in private bytes was due to the executable itself or some library it links. also note that "physical memory" is not a perfect description-what it really means is bytes that can be addressedWithout a page fault.

Translation:

Private bytes refers to the amount of physical memory that the process executable program has requested, not necessarily the amount of memory that it is actually using.Private bytes is "private" because it usually does not include memory-mapped files, such as shared DLL. however, it should be noted that although private bytes does not include the shared DLL itself, it will include the memory allocated by the shared DLL. therefore, if your executable files depend on any dll library (in fact, almost all executable programs depend on the dll library ), you cannot determine whether a change to private byte is caused by the executable program or by the DLL. also, note that "physical memory" is not a perfect description of private bytes. The true meaning of physical memory is the memory that can be addressed without page fault.

Original article:

Working SetRefers to the total physicalAddress SpaceUsed by the process. This includes des memory-mapped Files and quite possibly several other things; a 32-bit process can access 4 GB of address space andNot all of that address space is actually memory. This is the same value that gets reported in Task Manager's "mem usage" and has been the source of endless amounts of confusion in recent years. similarly to private bytes, this is "physical" in the sense that it can be addressed without a page fault.

Translation:

Working Set indicates all the physical memory address space used by the process.This includes memory ing files and some other things. A 32-bit process can address 4 GB of address space, and the 4 GB is not in the actual memory. similar to private bytes, physical in the working set description means addressing without page fault.

Original article:

Virtual bytesAre the totalVirtual Address SpaceOccupied by the entire process, including memory-mapped files such as shared DLLs. this is like the working set since t it has des data that has already been paged out and is sitting in a pagefile somewhere. the total virtual bytes used by every process on a system under heavy load will add up to significantly more memory than the machine actually has.

Translation:

Virtual byte is the virtual address space occupied by the entire process, including memory ing files such as shared DLL. it is similar to the working set, but it has to calculate the data in the pagefile where the page has been stored. the total virtual bytes of all processes in a high-load system is much larger than the actual memory of the machine.

 

Personal Understanding

====================

Suppose I have a machine with a physical memory of 1024 mb. The machine runs only three processes A, B, and C.

The following situations are possible:

A and B only share a library file named common. dll. Common. dll allocates 10 MB of memory for a and 20 mb of memory for B.

Common. dll occupies 30 mb of memory.

A's executable program and data itself occupy 40 MB, B uses 50 MB, and C uses 60 MB.

The executable program of a uses 5 MB of memory instead of the memory, which is in pagefile.

A Does not reference other DLL files.

 

The private bytes of A is 40-5 + 10 = 45 m.

The working set of A is 40-5 + 30 = 65 m

The virtual bytes of A is 40 + 30 + 10 = 80 m

 

Reference

====================

Performance Counter Definitions

Http://technet.microsoft.com/en-us/library/aa997156%28EXCHG.65%29.aspx

Memory performance information

Http://msdn.microsoft.com/en-us/library/aa965225%28v=vs.85%29.aspx

ASP. NET performance monitoring, and when to alert administrators

Http://msdn.microsoft.com/en-us/library/ms972959.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.