In Windows 95 and NT, each process has its own address space that enables it to address up to 4 gigabytes (GB) of memory. This means that Windows allocates 4 GB of memory addresses, not actual physical memory. The actual physical memory is limited to the available system resources (RAM and disk space). Windows allocates 2 GB of memory addresses to each application. Another 2 GB of memory addresses are reserved for the kernel.
Most systems are not equipped with 4 GB of physical RAM. Because of this, Windows uses virtual memory. With virtual memory, Windows can transfer some contents of physical memory onto the hard disk when the amount of physical RAM becomes low. This is known as swapping .
Figure 1.6 How Windows allocates virtual memory to applications
The virtual addresses used in a process do not represent actual physical locations in memory. Instead, the kernel maintains a page map for each process. A page map is an internal data structure used to translate virtual addresses into physical addresses.
Processors from the 80386 on can map memory locations to any 32-bit address. Windows virtual memory uses this capability to allow each program to behave as if it had its own physical RAM.
Windows uses a 32-bit linear addressing scheme to access memory. When an application attempts to access memory, it simply specifies a 32-bit memory address. Each program has its own virtual memory address space, which is mapped by a virtual memory manager onto a memory address. These addresses point to locations in RAM or on a hard disk.
Physical storage and the virtual (logical) address space of each process are organized into pages, which are units of memory whose size depends on the host computer. For example, on x86 computers the host page size is 4 kilobytes (KB). To maximize its flexibility in managing memory, the kernel can move pages of physical memory to and from a paging file (Pagefile.sys) on a disk. When a page is moved in physical memory, the kernel updates the page maps of the affected processes. When the kernel needs space in physical memory, it moves the oldest pages of physical memory to the paging file. The kernel's manipulation of physical memory is completely transparent to applications, which operate only in their virtual address spaces.
* To see the effects of paging with the Performance Monitor
This procedure will fill an array with space characters using a large amount of memory.
The Erase statement is used to re-initialize the array, HugeArray . HugeArray has been declared in the General Declarations section of the form.
This will open the System Monitor automatically.
Notice the increase in swap file activity and memory usage.