The main difference between physical and virtual memory is that the physical memory refers to the actual RAM of the system attached to the motherboard, but the virtual memory is a memory management technique that allows the users to execute programs larger than the actual physical memory.
Memory management is an important operation in an operating system. It allows the processes to move back and forth between the main memory and hard disk during the time of executing the program. Moreover, this process keeps on track of every memory location in order to allocate processes and to free the memory. Physical memory is the primary memory that has the currently executing programs. On the other hand, virtual memory extends the capacity of the main memory to execute large programs using the hard disk.
Key Areas Covered
1. What is Physical Memory
– Definition, Functionality
2. What is Virtual Memory
– Definition, Functionality
3. What is the Difference Between Physical and Virtual Memory
– Comparison of Key Differences
Key Terms
Main Memory, Physical Memory, RAM, Virtual Memory
What is Physical Memory
Physical memory refers to the RAM or the primary memory in the computer. Physical memory is a volatile memory. Therefore, it requires a continuous flow of power to retain data. However, power failures and interruptions can erase the data in the physical memory. Also, this memory is linearly addressable. In other words, the memory addresses increases in a linear manner.
The CPU can directly access the physical memory. It holds programs on the execution lineup. Usually, the hard disk stores the programs. It requires more time for the CPU to access the hard disk always to execute programs. Therefore, those programs are first placed in the physical memory so that the CPU can execute them faster. It takes less time to access data from the physical memory than accessing the data from the hard disk. After completing the execution, the programs go back to the hard disk. Likewise, the free memory can be allocated to a new program. When executing these programs, they are called processes.
What is Virtual Memory
Virtual memory is a logical memory. In other words, it is a memory management technique performed by the operating system. Virtual memory allows the programmer to use more memory for the programs than the available physical memory. If the physical memory is 4GB and the virtual memory is 16GB, the programmer can use the 16GB virtual memory to execute the program. Using virtual memory, he can execute complex programs that require more memory than the physical memory.
Moreover, virtual memory extends the use of physical memory by using the hard disk. It also prevents accessing the main memory directly. Furthermore, when accessing virtual memory, the virtual memory addresses convert to the corresponding physical address. Thus, virtual memory ensures memory protection.
Difference Between Physical and Virtual Memory
Definition
Physical memory, which is the actual RAM, is a form of computer data storage that stores the currently executing programs. In contrast, virtual memory is a memory management technique that creates an illusion to users of larger physical memory. Thus, this is the main difference between physical and virtual memory.
Memory Type
While physical memory is an actual memory, virtual memory is a logical memory.
Speed
Speed is another difference between physical and virtual memory. Physical memory is faster than virtual memory.
Technique
One other difference between physical and virtual memory is that the physical memory uses the swapping technique while the virtual memory uses paging.
Size
Physical memory is limited to the size of the RAM chip; however, virtual memory is limited by the size of the hard disk.
CPU
Physical memory can directly access the CPU while virtual memory cannot directly access the CPU. Hence, this is another difference between physical and virtual memory.
Conclusion
The main difference between physical and virtual memory is that the physical memory refers to the actual RAM of the system that stores the currently executing programs, but the virtual memory is a memory management technique that allows the users to execute programs larger than the actual physical memory.
Reference:
1. “Operating System Design/Physical Memory.” Wikibooks, Available here.
2. “Virtual Memory.” Wikipedia, Wikimedia Foundation, 20 Oct. 2018, Available here.
Image Courtesy:
1. “Laptop RAM” By WannaBeEditor – Own work (CC BY-SA 4.0) via Commons Wikimedia
2. “Virtual memory” By Ehamberg – Own work (CC BY-SA 3.0) via Commons Wikimedia
Leave a Reply