maximising code sharing

Paul Smith psmith at netezza.com
Mon Jan 15 16:39:30 UTC 2007


On Mon, 2007-01-15 at 23:26 +0800, Rogelio Serrano wrote:
> how are shared libraries loaded? does the linker load the entire
> library file? or only the needed functions?
> 
> i was wondering if there is a way to improve on memory footprint of
> multiple static linked busybox instances running at once.

Shared libraries don't buy you anything for multiple instances _of the
same application_.  The Linux kernel will already share everything that
it is possible to share for those.

The place shared libraries win is when you have lots of _different_
programs all using the same library (think of libc etc.): in that case
the kernel can share the read-only sections of the shared library even
between instances of different programs.

Since shared libs also have a runtime cost (not huge but not
insignificant) you should consider whether they will benefit you or not.

Cheers!

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <psmith at netezza.com>                       http://netezza.com
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist
-----------------------------------------------------------------------------
      These are my opinions--Netezza takes no responsibility for them.



More information about the busybox mailing list