How does processor know about a process's address space
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How does processor know about a process's address space
Dear all,
I was studying the linux virtual memory system.
Because I am reading it for the first time I have many confusions.
Linux maintains VMA and page table data structures corresponding to virtual address space of processes on the system. Through page tables it maintains the mappings from process virtual address space to physical address space.
It means that every process has an address range and if it tries to accss beyond it segmentation fault will occur.
okay so far its fine...
I had a doubt that when a process being executed by the processor then how will processor keep track of its virtual address space. Every time a process tries to access some particular address, for example process writes some data as mentioned by the following pseudo code:
STORE <value> <address>
1.
Now how will processor verify that this address comes under its virtual address space or not?
After thinking a bit I made an understanding, Because processor accesses its own (hardware) page tables every time an address is accessed. In case no entry is found corresponding to any virtual address, processor will jump to the page fault exception handler of the kernel.
2.
But after making this understanding I again had a doubt that does it mean that every time a process is scheduled for execution by the kernel , kernel also populates processor's page tables?
3.
If yes, then does it mean that architectures which do not support paging hardware cannot run linux kernel? Or is it possible to run linux without VM on those architectures.
Please comment on it, if you feel that I making any wrong understanding about the kernel operation then please correct me.I would appreciate if you answer my questions point wise and at the same time apart from answering questions please write a descriptive text also.
Thanks
Last edited by nitinarora; 07-09-2010 at 02:20 AM.
2.
But after making this understanding I again had a doubt that does it mean that every time a process is scheduled for execution by the kernel , kernel also populates processor's page tables?
This is absolutely correct and is one main reason, the "context switch" (from one AS to another) is very expensive. For a lot of theory on that (not linux-related), I could recommend the great work of the L4 team at university of karlsruhe: http://i30www.ira.uka.de/teaching/co...eid=182&lid=en
Quote:
3.
If yes, then does it mean that architectures which do not support paging hardware cannot run linux kernel? Or is it possible to run linux without VM on those architectures.
No idea, sorry -- but at least, it seems difficult without hardware support for virtual memory.
1.
Now how will processor verify that this address comes under its virtual address space or not?
After thinking a bit I made an understanding, Because processor accesses its own (hardware) page tables every time an address is accessed. In case no entry is found corresponding to any virtual address, processor will jump to the page fault exception handler of the kernel.
There's a hardware unit, MMU, which does exactly what you describe. The complexity of this unit varies between architectures, but the general idea is that if it doesn't find an entry, it makes an exception.
Quote:
2.
But after making this understanding I again had a doubt that does it mean that every time a process is scheduled for execution by the kernel , kernel also populates processor's page tables?
Generally yes.
Quote:
3.
If yes, then does it mean that architectures which do not support paging hardware cannot run linux kernel? Or is it possible to run linux without VM on those architectures.
An architecture without an MMU doesn't have virtual memory, but can run Linux. There's an option for no-MMU systems (often called uCLinux, but it's in mainline).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.