Reputation: 4642
As far as my understanding goes, a program is allocated contiguous address spaces in the virtual memory. The address space contains the heap, the stack, the data and text section, and some free space.
But actually, the these sections are not contiguous in the physical memory (RAM). If this is the case, then can't it solve external fragmentation? I mean, the whole point of external fragmentation is that we do not have enough contiguous space. So, why not break-up the segments and use the non-contiguous space?
I know that I am missing something. Can someone elaborate on this? Thanks.
Upvotes: 0
Views: 484
Reputation: 57
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.
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.
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.
Upvotes: 0
Reputation: 21607
The logical to physical page mapping solves one fragmentation problem but not all of them. An operating system typically has memory pools that can become fragmented. Also, there is some need to for the operating system to manipulate physical memory. One example is the page tables themselves. Some portion (if not all—depends upon the underlying hardware) of a page table must be in physical memory.
Upvotes: 1