Subject: Dynamically linked programs
To: None <email@example.com>
From: Paulo Alexandre Pinto Pires <firstname.lastname@example.org>
Date: 08/28/2002 02:50:55
The debate about NetBSD's change towards dynamically linked programs
in /bin and /sbin gave rise to the issue of performance penalties
that may affect common tools (like the shell, test(1), expr(1), cat(1)
and others, heavily used in scripts that make our lives easier), and
thus compromise usability of certain older and slow systems.
What about memory issues, that the same older systems are likely to be
short of (not to mention embedded systems and handhelds we currently
can run on)?
I did a very simple program, which fork()s and wait()s the child, which
runs "ps -aux", just to measure its dummy parent VSZ and RSS. I compiled
the program to produce both static and shared binaries, and the results
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
pappires 562 0.0 0.0 72 72 p2 S+ 1:55AM 0:00.00 ./test-static
pappires 565 0.0 0.1 16 340 p2 S+ 1:55AM 0:00.00 ./test-shared
ps(1) shows a resident segment size for the shared version almost five
times as large as that of the static version. The virtual space, on
the other hand, is 4.5 times smaller.
Which one matters? Does RSS count shared pages multiple times, for
each process that depends on a shared library (here, only libc)?
... Qui habet aurem audiat quid Spiritus dicat ecclesiis.