On Thu, Sep 17, 1998 at 04:47:11PM +0200, Ivan Sergio Borgonovo wrote:
> Finally... 640Kb aren't too few if you do good coding...
> Spreadsheet, Word processor, browser, editor etc...
> If you are doing image editing (very memory hungry 
> 1024x768x16Millions color= 2.5Mb) I'm sure you can do very 
> interesting work with 6Mb (oops how many Mb are required for w98???)

Quite true.  Back in the early 80's, we were operating DEC VAX 11/780
systems with 2-4 Mb of memory, 3.X/4.X BSD Unix, and 20-40 users each.

That turned out to be woefully inadequate when X became popular; but
in turn, X spurred the development of shared libraries, which made
the situation reasonably tolerable again.

(Geek alert: shared libraries enable executable binaries to use
less memory than they would otherwise.  The idea is that if foo.c
and bar.c, two different programs, each written in C, both use
library routines printf() and strcmp(), we *could* add the executable
code that constitutes those routines to the executable code
for both programs (foo.o and bar.o) in order to make runnable binaries;
in fact, that's what was and is still done: it's called static linking.
"foo", the executable, has the compiled code from foo.c plus whatever
routines from the C library (libc.a) that it needs to run.  "bar" is
likewise.

This is all well and good *except* that when we execute foo and bar
simultaneously, each running binary has a copy of printf() and strcmp()
inside it, making both larger.  It would be nice if there was some
way for them to share those two routines so that only one copy need
be in memory.  And that's what dynamic linking does: when "foo" gets
compiled, a reference to printf() and a reference to strcmp() are
inserted, but not the code itself.  When "foo" gets run, the Unix/Linux
kernel detects that it is a dynamically linked executable, and
resolves the references to point to the actual runnable code
for printf() and strcmp() -- and that code lives inside a sharable
version of the C library (libc.so) which is paged in on demand.

In other words, if "foo" is the first program to be run, then
the part of the sharable C library with printf() and strcmp()
will get pulled from disk into memory and used.  If "bar" is
then run, those routines are already there, so not only did we
save space, we also saved time: "bar" will load faster and run
quicker because the routines it needs are already in memory.

Sounds like a lot of complexity, and sometimes it is: but when
the X Window system equivalent of the "hello, world" program is 600 Kbytes
statically linked, the ability to drop that to 20 Kbytes dynamically
linked is a huge performance win.

Now will someone explain to me why I felt compelled to expound on this? :-) )

---Rsk
Rich Kulawiec
[EMAIL PROTECTED]
____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to