niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Unix internals
excec( ) implementation basics [are ELFs mmap-ed to Process Address space?]
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
50295@web.de
*nix forums beginner


Joined: 09 Feb 2005
Posts: 32

PostPosted: Wed Jan 18, 2006 4:56 pm    Post subject: excec( ) implementation basics [are ELFs mmap-ed to Process Address space?] Reply with quote

Hi -

I've been stracing loads of stuff lately, trying to and I'm wondering
how mmap actually words/is implemented on *NIX systems. I suspect
mmaping the executable (elf binary) to the process' address space would
be a good idea. Is this how mmap is implemented? I know shared
libraries are are implemented with mmap (and quite possibly shared
memory i.e. shmget etc), but I'm not sure how exec() is implemented.
Hints anyone?

Please dont ask me to take a look at the source. I have, but it made my
head spin.

Thanks,

- Olumide
Back to top
moi
*nix forums beginner


Joined: 09 Oct 2005
Posts: 5

PostPosted: Wed Jan 18, 2006 5:18 pm    Post subject: Re: excec( ) implementation basics [are ELFs mmap-ed to Process Address space?] Reply with quote

50295@web.de wrote:
Quote:
Hi -

I've been stracing loads of stuff lately, trying to and I'm wondering
how mmap actually words/is implemented on *NIX systems. I suspect
mmaping the executable (elf binary) to the process' address space would
be a good idea. Is this how mmap is implemented? I know shared
libraries are are implemented with mmap (and quite possibly shared
memory i.e. shmget etc), but I'm not sure how exec() is implemented.
Hints anyone?

The best way, IMHO is to look upon it is in terms of hardware/MMU.
mmap makes clever use of the hardware, by setting up pagetable-entries,
which point to the address space and the appropriate diskpages.
The first access to a mmapped page wil cause a (page not present)
pagefault, and the page will be read in by the pagefault handler.
("faulted in")

Copy-on-write is just a useful extension to this scheme.
Execution of pages is basically the same, except for relocations,
which have to be fixed up by the loader. Don't know how that works,
I suggest you need to read the sources for that ;-]

Quote:
Please dont ask me to take a look at the source. I have, but it made my
head spin.


It is supposed to make the disks spin, not your head.

Quote:
Thanks,

- Olumide


HTH,
AvK
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Tue Dec 02, 2008 6:47 pm | All times are GMT
navigation Forum index » Programming » Unix internals
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Postfix ldap and Rewriting sender email address endfx Postfix 2 Thu Apr 17, 2008 9:34 pm
No new posts recipient address restriction 3dd13 Postfix 0 Wed Mar 26, 2008 1:46 pm
No new posts Linux2.6 mmap problem, pls help me seven_007 python 1 Sat Sep 30, 2006 3:10 am
No new posts FAQ 4.32 How do I strip blank space from the beginning/en... PerlFAQ Server Perl 0 Fri Jul 21, 2006 1:03 pm
No new posts ssh not exiting because of spawned process Old Wolf Solaris 1 Fri Jul 21, 2006 12:54 am

Mobile Phone | Homeowner Loans | WesternUnion | Mortgage Calculator | Myspace Layouts
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1451s ][ Queries: 16 (0.0704s) ][ GZIP on - Debug on ]