Libraries - Who needs them
My system has been getting sluggish lately and the file
browser was
taking forever. To better understand the problem I began to check
the size of various
directories... and that is when a strange result appeared:
The following script will count files, guess
what it said?
ls -R i/usr/lib/* | wc -l
One would expect to see a file count. What I saw was
61,112
. Assuming it was a mistake I tried a few other tests. Same
result, my system had 61,112 files in /usr/lib. After more
digging it was clear that many of these files were seldom used and some
had never been used. Well.., disk space is cheap, but ii
does make one wonder why so many library files are used.
The /usr/lib directory is suppose to contain either
dynamic or
static library files. The static files are used to build programs
at compile time and the dynamic libraries link with programs at run
time. I found a lot of each, but mostly they appeared to be
dynamic library files.
The theory is that disk space is saved by having programs
share
dynamic library files. The library files can be shared by many
programs and even remain in memory to save load time. Sounds good, but
the theory was did not match what I was seeing.
This leads to another question. What are the disadvantages of
dynamic libraries:
How about:
1. Dynamic libraries need to retain symbols and this
takes up
more disk space.
2. Dynamic library linking slows down execution of programs.
3. Each language trys to write its libraries in their own
language and there are thousands of languages.
4. Novice users and others have problems keeping library versions
current and sometimes multiple versions of the same library are
needed. This is often called dependency hell.
Those problems can be bad, but they don't explain my
system.
I was seeing proliferation of libraries that were added just incase
they were needed.
If we step back and think about this, it appears programmers
are
extending their language and programs by adding library
functions. Essentially, we are growing programming
universes via
libraries. Each universe continues to expand. We have a
Perl universe, a "C" universe, a open office universe, and so on.
All this growth is part of freedom and fits well with Linux
philosophy. It also is beginning to look like bloat and
confusion. At some point we might want to ask: Do dynamic
libraries have more disadvantages than advantages? Can we improve
all this and make Linux more efficient?
Responses to these questions seem to fall into two
camps.
Those that view the basic system structure as sacred and
untouchable. Another group that see it as too difficult too
change. Both views ignore the problem. I think we need to
take a hard look at the data and generate some solutions.
What do you think?
|