Understanding the Memory concepts on Windows is an important part to note performance problems and resolve them.
Many times the term of Physical memory can be confused with the concept of Virtual memory:
Virtual Memory and Physical Memory
The physical memory (RAM) is managed directly by the Windows Memory Manager. Every process has its own memory space and private memory address which can only be accessed by this process. The exception is the shared memory, which can be accessed by many processes.
The physical memory has 3 states: Free, Reserved and Committed. On Free state the memory is free and inaccessible, on a Reserved State the memory is reserved to an specific process, and on a committed state the reserved memory is been used by the process and is been backed up by physical memory. For the memory to be free again, the process needs to free its reserved memory.
Another part of the Physical memory is the page file which is by default located on the system drive. This file (pagefile.sys), is used as RAM memory, so in case a process needs a memory space on RAM and there isn’t availability, the Windows Memory Manager will make some room by moving data that is not in used to the page file, when this data its needed again, a reverse process will take place putting the data from the page file on RAM.
Now, the Virtual Memory is a technique that allows a process to have the impression that is using a contiguous memory space, so if there where fragmentation will be transparent to the process. We can define the used Virtual Memory as the RAM memory + Page File used (always on committed state),
It’s also convenient to talk about Virtual Address Space, each process has a private virtual space of memory also call Virtual Address Space or VAS, this mechanism prevent the processes to steps into each other memory space, and it’s the VAS space that you can overlook when finding memory problems.
VAS is used on a memory mapping mechanism where physical memory (RAM and page file) is map to VAS by the Operating System. This way you can restrict direct access to physical memory and isolate each process.
VAS and technology used:
VAS Components
The kernel mode is an important part when doing a performance analysis on a server; we will see this on future posts.
Memory tweaks
The memory tweaks for 32 bits architectures are: 3GB, PAE and AWE
Usually the 3GB and PAE switch are mistaken, they are both added on the boot.ini (Windows 2003) or the bcdedit command (Windows 2008/R2), but have different behaviors.
These switches are only useful on 32 bits architectures, these switches are not needed on 64 bits architecture.
“The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of Microsoft”