0
$\begingroup$

I trying to learn about virtual memory at the moment and one of the explanations I've look at has a diagram like below. You can see that 32 bit virtual addresses are used so the virtual address space is 2^32 addresses and the computer must have RAM of a capacity 4GiB or smaller. You can see the physical addresses in the diagram are only represented with 30 bits though so 1GiB of physical memory is present which is where my confusion is. I though there must be 32-bits physical addresses as well because there are also 2^32 physical addresses and that the hard disk is used to store the physical pages that won't fit in main memory. Am I missing something? enter image description here

$\endgroup$
1
  • $\begingroup$ "I though there must be 32-bits physical addresses as well because there are also 2^32 physical addresses": what ?? $\endgroup$
    – user16034
    Commented Nov 23, 2022 at 8:53

2 Answers 2

1
$\begingroup$

Intel built 32 bit chips a while ago that could access more than 4 GByte of RAM.

You have two addresses for data: You have a logical address that your software cares about, and you may have a physical address with actual RAM (or video memory, or hardware that can be controlled with memory read/write instructions).

If you run more than one process, each process can use the same logical addresses, but they refer to different actual data. So with these older memory chips, process one could have 0 to 4GB logical space mapped to RAM at location 1GB to 5GB, process two could have 0 to 4GB logical space mapped to RAM at location 5GB to 9GB, and no RAM with addresses 0 to 1GB at all.

On the other hand, the latest processors have 64 bits for logical addresses (that's 256 billion billion bytes) and only 53 bits for physical addresses (which is about 8 million billion bytes, which is just a little bit more than I can afford. I can order a computer with 1500 billion bytes of RAM on the internet for 20,000 to 30,000 dollars, so 41 bits wouldn't have been enough).

Your example seems to only have 30 bits for physical addresses, so it is limited to one billion bytes. Unless some different tricks are involved, which are not needed nowadays.

$\endgroup$
1
$\begingroup$

A key benefit of virtual memory is a complete decoupling between the virtual address space and the physical locations. The virtual memory manager maps the virtual addresses of a process to some physical space that can reside on disk or in RAM (as pages), and that mapping changes dynamically. The RAM space of the machine can and is often smaller than the virtual space (in theory, a computer could work with a single page of RAM). It could also be larger !

It is also important to understand that all processes enjoy the same virtual space free for their own use, regardless the coexistence of other processes. The memory manager maps independently for every process.

In fact, a modern OS simulates several computers with a large RAM space, each assigned to a process, in a transparent way.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.