LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2007, 05:09 PM   #1
duncan21
LQ Newbie
 
Registered: Mar 2007
Location: LA
Distribution: LFS
Posts: 4

Rep: Reputation: 0
Does dynamic linking reduce disk reads?


For example, say I have a procedure p compiled into a dynamic link library l.so. Assume there is no program in memory that has linked to l.so and called p.

Now I execute program A, which links to l.so and calls p, thus having the loader copy p into A's local address space. Now suppose I execute program B, which links to l.so, and calls p also, while program A is still running and loaded into memory.

Does the loader have to copy and link the object code from the file l.so again, or does it copy (and re-link) the body of p from the copy stored in A's address space? It seems like it would make sense to do it this way, but my copy of Patterson and Hennessey doesn't address this (at least not in the section on dynamic link libraries that I'm currently reading).

BTW, any time I write memory I mean core + virtual memory

Thanks

Last edited by duncan21; 03-14-2007 at 05:24 PM.
 
Old 03-15-2007, 02:52 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
In most cases the two copies of l.so will be actually shared, with only one existing in the memory. It is system-dependent, however.
 
  


Reply



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
LXer: Chapter 7: Static Meets Dynamic Adding Caches to Reduce Costs LXer Syndicated Linux News 0 08-16-2006 01:54 PM
floppy only reads first disk, if new disk is inserted data from first disk is shown. lakosked Debian 3 02-18-2006 08:44 PM
dynamic linking joshknape Linux - Software 1 09-19-2005 09:43 PM
dynamic linking and g++ kris273 Programming 10 08-16-2004 02:16 PM
Static/dynamic linking ugenn Linux - Software 0 12-15-2002 11:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:10 PM.

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