MEMORY MANAGEMENT IN WINDOWS 10
For efficient management of tasks in a system, proper utilization of memory is necessary. Hence memory management is one of the prime tasks performed by an operating system. The system is composed of two types of memory– Physical and Virtual memory.
(i) Physical Memory
Physical memoryis also known as RAM. All the programs and data during execution along with the kernel of operating system are stored in RAM. Elements stored in this memory are directly accessible by the processor. Addresses that belong to physical memory are called physical address space. It can be further divided into user address space where user’s data or program can be stored and kernel’s address space where kernel is stored.
(ii) Virtual Memory
Virtual memory is capability of using hard disk as additional memorywhen RAM does not have sufficient capacity to store the data or programs. Data or programs stored in RAM are also mapped to virtual address space by operating system. Operating system has a program called virtual memory manager which uses method of paging to map virtual to physical address space. If physical memory is able to accommodate the processes, then virtual addresses are directly mapped to physical address but if physical memory is not able to store processes together then virtual memory manager allocate memory to processes one by one till all the processes complete using technique disc paging and demand Paging.
Disc Paging extends the computer’s physical memory (RAM) by reserving space on the hard disc called Page File which the processor views as non-volatile RAM. When there is not enough memory available in RAM to allocate to a new process, the virtual memory manager moves data from RAM to the Page file. Moving data to the Page file frees up RAM making room for the new process to complete its work.
Demand Paging is key to using the physical memory when a number of processes must run with a combined memory demand exceeding the available physical memory. This is achieved by segmenting the process into smaller tasks
Memory Representation
The amount of physical memory used by a process is called a Working Set. The Working Set of a process is comprised by its Private working set and its Sharable working set both of which are owned by the same process. The Private working set is the amount of physical memory in use pertaining to tasks that are dedicated to the process. The Sharable working set is the amount of physical memory in use by the process pertaining to tasks that can be shared with other processes.
Working Set of a process = Private Working Set + Sharable Working Set.
For example, when you open a Word document, the winword.exe remains in the Sharable working set and the contents of the document is put in Private working set. Thus several word documents opened simultaneously can share the same winword.exe while their data is private and distinct. Shared system resources such as DLLs, System drivers (Kernel/OS.sys files) exists solely as a Shared process with no private working set. Tasks and Services comprise the executable processes (.exe) which are primarily private working sets having a sharable resource.
The Commit and Working Set of all running processes can be viewed on the Memory tab of the Resource Monitor. The Commit is the amount of Virtual Memory reserved by the operating system for a particular process. This amount is only an estimation of the Page File size needed by a process, and is not allocated till it becomes necessary for the system to page out the Private working set of a process in physical memory to the Page File. It is for this reason, the Commit size is always larger than the Private working set of a process.
When a machine boots up, the operating system creates two dynamically sized pools in physical memory to allocate the kernel-mode components. These two pools are known as the Paged Pool and Non-paged Pool.
The Paged Pool value (247 MB, refer to Task Manager screenshot on top) indicates the amount of physical memory used by the Kernel to store objects that can be written to disc (paged) when they are no longer used.
The Non-paged Pool value (140 MB, refer to Task Manager screenshot on top) indicates the amount of physical memory used by the Kernel to store objects that cannot be written to disc but must remain in physical memory at all times.
The Committed (1.7 GB) as seen on the Task Manager > Performance tab > Memory section, is the sum total of Working sets of all running processes + amount of data cached in Page file, or in other words the Virtual Memory in use.
Total Virtual Memory = Total Physical + Page File Size
= 3800 + 1024 = 4824 MB = 4.71 GB.
Total Virtual Memory = Committed (Virtual In Use) + Available Virtual Memory
Or, Committed (Virtual In Use) = Total Virtual – Available Virtual
= 4.71 GB – 2.96 GB
= 1.75 GB (as seen on Task Manager).
The Virtual Memory term in Windows is actually polymorphic. One terminology applies to memory representation where in the true technical sense, Virtual Memory = Physical memory + Page file, although the term Virtual Memory is more often used as a synonym to Page File.