What differences and relations are between logical and virtual memory

computer-architecturememoryvirtual-memory

I was wondering what differences and relations are between logical and virtual memory? How do their purposes differ?

Are the relations and differences the same for logical and virtual addresses?

Best Answer

Let's go over the difference between virtual and logical addressing first. I believe the distinction is that "logical address" means that the address the program sees is different from the physical address of the data being stored in RAM.

If you have virtual memory, there may be no physical address at all, as the data stored could be swapped out to disk. However, it is possible to have a system without virtual memory where logical addresses are different from physical addresses, but each logical address is mapped to a physical address. This would make it easier to run multiple programs without them stepping on each other, but wouldn't let the programs use more memory than the physical memory available to the system.

So there is no separate "logical memory" in a computer, though I suppose you could say that a computer with logical addresses but no virtual memory system has a logical memory system. I would just say that logical memory is memory addressed via some indirection method. Is there some specific computer system that you have in mind?

--

Taking your comments into account:

Logical addresses for the same physical memory can be the same or different. Usually two processes won't have access to the same memory, since then one can corrupt the other. However, if they have arranged to use some form of shared memory, they will usually map that shared memory to different addresses. Virtual addresses are more or less a type of logical address, so if you have an operating system that supports VM, and two processes map shared memory, they will usually see that memory as being at different addresses, the same as if there was no virtual memory.

As for your understanding of the purpose of logical vs virtual, virtual memory is for using the HD to extend the memory that you have available to programs. Logical addressing can be used for more than process separation, but that would be one major use.