r/AskComputerScience • • May 14 '25
confused about virtual memory
If I got this right, the point of virtual memory is to ensure processes use unique physical address space.
Is this abstraction really needed ?
For example, say there are 2 C programs and each one does malloc. This asks the OS for memory. Why can't the OS guarantee that unique physical address space is given to the C program ?
2
Upvotes
View all comments
Show parent comment
1
u/SubstantialListen921 May 14 '25 edited May 14 '25
A pointer is just another kind of variable in a program. Except that, instead of holding a value, it holds a location in the memory of the computer.
The location can be “physical” in that it represents an actual cell on a DRAM chip somewhere, or it can be “virtual” in that it represents an arbitrary number offset into an abstract, idealized model of memory provided by a virtual memory management unit.