1
$\begingroup$

While studying about memory management, paging and segmentation there is a lot of usage of phrases like CPU generates logical addresses and logical addresses are converted to physical addresses etc. I know that the term physical address refers to actual RAM, but I do not have clear idea about what logical address is and where does it reside.

So my questions are:

  • What is meant by CPU generates logical address?
  • Where do logical addresses reside (in RAM or somewhere else)?

Can anyone please explain these things.

$\endgroup$
4
$\begingroup$

Well, this is the entire point of "virtual memory".

When your program runs, the OS makes it believe it has all the memory just for itself. That is, addresses 1 to 10,000 (say), are all empty and ready for this program to use. If you run two programs, each one of them gets its own space - each one can access address 1 to 10,000 without any interference between the programs.

Obviously, for this to work, the OS must perform some clever bookkeeping, mapping the programs' "virtual memory" into places in the real memory (or hard disk). That is, when the first program access cell 200, the information needs not be in cell number 200 in the real memory. It may be somewhere else, but the OS is responsible of converting the (virtual/logical address) "200" of the first program to some (real) address X, as well as the virtual "200" address of the second program, to some other (real) address Y.

$\endgroup$
  • $\begingroup$ @ Ran G:In your answer you have written ". . . the information needs not be in cell number 200 in the real memory. It may be somewhere else, but the OS is responsible . . .", so what do you mean by "somewhere else"? Can it be RAM or Hard disk (or firstly it may be in RAM; if RAM isn't free, then it may go in hard disk)? Also does it depend on the implementation of a particular OS or it always is the same in all OSs. Actually that is the main point I cannot understand that where do logical addresses reside. And what about second point: "CPU generates logical addresses"? What is meant by this? $\endgroup$ – swdeveloper Apr 26 '16 at 5:41
  • $\begingroup$ Yes, if the RAM gets full, the OS may flush it down to the harddrive (see paging). the implementations is OS dependent. To make things faster, the CPU supports this process through a special unit called MMU, which usually performs the translation in hardware. Check also Virtual Memory. $\endgroup$ – Ran G. Apr 26 '16 at 18:31

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.