From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from adsl-216-102-199-169.dsl.snfc21.pacbell.net ([216.102.199.169]) by hawkwind.utcs.utoronto.ca with SMTP id <25175>; Fri, 14 Jan 2000 15:32:44 -0500 Received: (from haahr@localhost) by adsl-216-102-199-169.dsl.snfc21.pacbell.net (8.8.7/8.8.7) id LAA11797; Fri, 14 Jan 2000 11:18:07 -0800 X-Authentication-Warning: iadd.jivetech.com: haahr set sender to haahr@jivetech.com using -f From: Paul Haahr X-Attribution: haahr Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Tim Goodwin Cc: rc@hawkwind.utcs.toronto.edu Subject: Re: Dynamically loading readline on demand (was Re: rc futures) In-Reply-To: References: X-Mailer: VM 6.30 under Emacs 20.3.1 Date: Fri, 14 Jan 2000 14:18:49 -0500 Tim Goodwin wrote, replying to me, replying to him: > > > I took an rc script that does nothing (makes no system calls) except > > > fork() and wait() 10000 times. > > > > Are you sure it doesn't exec at all? > > You tell me. > > for (i in 0 1 2 3 4 5 6 7 8 9) > ... > for (m in 0 1 2 3 4 5 6 7 8 9) > @{ ~ 0 0 } > > According to strace on my Linux box, each loop calls fork(), close(), > rt_sigaction() twice, _exit(), and wait(). Fascinating. My guess was definitely wrong. > > > ([...] Why does dynamic linking increase the user time? > > The short answer is ``because dynamic > > linking is done with user-space code.'') > > Yeah: in crt0. But (I'm sure) that isn't involved here. I'd expect > fork() to take more *system* time (since there are more MAP_SHARED page > table entries to fiddle with), but I don't understand the increase in > user time. The only thing I can guess is that using the PIC version of the code in the shared libraries and the shared library calling sequences is hurting much more than I would have expected. (Chapter 8 of Levine's book goes into the issues here.) My guess would have been at most a 10% hit, not the 30% you're reporting. Detailed profiling might shed more light. --p