0
$\begingroup$

I read that the mapping for user-space processes is changed after each process switch. By mapping I mean the translation from virtual addresses to "real" memory address. I thought that processes are loaded into RAM and are held there (that's what the RAM is for). So the addresses in "real" memory addresses shouldn't change too much over time, because the process is held in RAM.

Where am I mistaken?

$\endgroup$
0
$\begingroup$

Processes don’t use real RAM addresses. If they did, virtual memory couldn’t possibly work.

If the data is actually in RAM, then the data of process A at A’s location 1000 is not the same and therefore not stored in the same place as the data of process B at B’s location 1000

So the mapping must change when we switch from process A to process B. Address 1000 must be mapped to different addresses in RAM or not in RAM at all.

And processes are not loaded into RAM, they are loaded into address space, that is a mapping between address space and RAM or virtual memory is set up. This allows having processes larger than RAM and allows switching between processes with large amounts of data quickly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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