LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-09-2010, 01:38 AM   #1
nitinarora
LQ Newbie
 
Registered: Apr 2009
Posts: 19

Rep: Reputation: 0
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.
 
Old 07-09-2010, 01:48 AM   #2
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Quote:
Originally Posted by nitinarora View Post
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.
 
Old 07-09-2010, 04:23 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
Originally Posted by nitinarora View Post
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Address Space Randomization on 2.6.28-15-generic ubuntu 9.04. Finding base address nullprocess Linux - Security 1 09-15-2009 12:56 AM
Address Space Randomization on 2.6.28-15-generic ubuntu 9.04. Finding base address nullprocess Linux - Kernel 1 09-14-2009 08:31 PM
Address Space Randomization on 2.6.28-15-generic ubuntu 9.04. Finding base address nullprocess Linux - Kernel 0 09-14-2009 10:45 AM
Monitoring a process's logical address space krock923 Programming 0 12-02-2007 03:54 PM
processor ID, Hardisk Volume ID, Ethernet Mac Address sadafwaqas Linux - Hardware 1 05-17-2006 08:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration