1

I am reading Understanding Linux Kernel. There, I am trying to understand how logical address got translated to physical address. To my understanding, I believe logical address got translated to linear address(with the help of Segmentation Unit) and then linear got translated to physical address(with the help of paging unit). Digging a step deeper, I found set of segmentation register changes only if we are switching from user to kernel mode, else it remain constant. i.e. for the various process executing in user mode, the set of segmentation register which is cs, ds, ss etc. are same. And also in the segment descriptor table base and limit fields of various process executing is also the same.
Under such situation, I am not able to understand how logical address of one process differs from the logical address of another?

6
  • Did you read the Paging part ? Just read the Paging part thinking Segmentation is not there at all in Linux.
    – bluefoggy
    Sep 10 '14 at 8:06
  • @kingsdeb, yes I have gone through paging part. I think the differentiation of logical addresses are not covered there too. Sep 10 '14 at 8:15
  • Segmentation is in x86 for historical purposes. Modern operating systems (Windows, Linux, MacOSX) ignores it. x86-64 in long mode actually does not support segmented addressing at all.
    – Siyuan Ren
    Sep 11 '14 at 9:02
  • Indeed you're true @C.R. What I meant to ask is, how in such cases logical address of 2 different process differs? Sep 11 '14 at 15:00
  • I don't quite understand your question. The raison d'etre of logical address is that different processes can have separate address space. In other words, the numeric relations (such as equality) between logical addresses of different processes have no meaning at all.
    – Siyuan Ren
    Sep 12 '14 at 3:16
0

The different mappings (per-process) of the same set of logical addresses to different physical on x86 Linux is ONLY through paging. I.e. Basically the different CR3 register value which points to a different PGD for each process. With the same CS, DS values throughout (meaning, nothing unique about these per-process, and same thing goes for the segment descriptors as well, only the permissions differ between user-mode and kernel-mode), you have the same set of linear addresses for all processes, and hence the only difference that can be had is via paging. Thank You Krishna Kumar Sir for your answer.

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.