From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Russ Cox" To: 9fans@cse.psu.edu Subject: Re: [9fans] Getting started in Plan9 - help MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20020121202132.4BD0D199E8@mail.cse.psu.edu> Date: Mon, 21 Jan 2002 15:21:30 -0500 Topicbox-Message-UUID: 3fddcac2-eaca-11e9-9e20-41e7f4b1d025 First of all, I was kidding about readline. > * If dynamic linked libraries, you have taken the first step > on the slippery slope to the land of gratuitious complexity, > where even a simple "hello, world" C program can execute > 100000 instructions before it actually prints anything. > (No, I'm not kidding.) For some reason, people seem to think > adding features in dynamic libraries is "free". If I'm running rio on Plan 9, draw a new window, and run hello world, how many instructions execute before I see "hello world" on my screen? Lots and lots, just not many in the hello world process. The kernel has to redirect the write into rio, rio does some lookups to figure out which window gets the output, libdraw has to walk around in the font caches, possibly loading the missing letters, (which is more kernel calls, context switches to kfs, and execution of the various code in devsd), finally preparing a "draw string" request for /dev/draw. Then the kernel is back. For simplicity let's assume that the window is in front of all the others, so memlayer isn't involved. Now we clear the background, either with memset or by making calls to an accelerated vga routine with some busy waits (still faster than memset, though). Then we use per-character calls to memimagedraw to blacken the appropriate pixels. And finally we see "hello world" (assuming that we have direct access to video memory; if not, we've been drawing in a soft screen and still need to flush the changed portion out to video memory). You're still right, of course; dynamic libraries are a slippery slope for lots of reasons. My point is that the overhead of dynamic libraries is not necessarily worse than the overhead of other system services like the kernel and the various Plan 9 file servers, just in a different place. It takes far more than 100,000 instructions to get "hello world" onto my screen either way. How you count depends on what you care to include. Russ