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.
|