From owner-freebsd-stable Wed Dec 9 16:53:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA23511 for freebsd-stable-outgoing; Wed, 9 Dec 1998 16:53:05 -0800 (PST) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from point.osg.gov.bc.ca (point.osg.gov.bc.ca [142.32.102.44]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA23506 for ; Wed, 9 Dec 1998 16:53:01 -0800 (PST) (envelope-from Cy.Schubert@uumail.gov.bc.ca) Received: (from daemon@localhost) by point.osg.gov.bc.ca (8.9.1/8.8.8) id QAA07214; Wed, 9 Dec 1998 16:52:47 -0800 Received: from passer.osg.gov.bc.ca(142.32.110.29) via SMTP by point.osg.gov.bc.ca, id smtpda07212; Wed Dec 9 16:52:28 1998 Received: (from uucp@localhost) by passer.osg.gov.bc.ca (8.9.1/8.9.1) id QAA22423; Wed, 9 Dec 1998 16:52:26 -0800 (PST) Message-Id: <199812100052.QAA22423@passer.osg.gov.bc.ca> Received: from localhost.osg.gov.bc.ca(127.0.0.1), claiming to be "passer.osg.gov.bc.ca" via SMTP by localhost.osg.gov.bc.ca, id smtpdw22414; Wed Dec 9 16:51:57 1998 X-Mailer: exmh version 2.0.2 2/24/98 Reply-to: Cy Schubert - ITSD Open Systems Group X-Sender: cschuber To: Alfred Perlstein cc: Alberto de Poo Bas , stable@FreeBSD.ORG Subject: Re: Weird Process Timings In-reply-to: Your message of "Wed, 09 Dec 1998 15:26:13 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 09 Dec 1998 16:51:57 -0800 From: Cy Schubert Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message , Alfre d Perlstein writes: > On Wed, 9 Dec 1998, Alberto de Poo Bas wrote: > > > > > I have a machine with 2.2.6 and the 31dec69 date it show when someone have > > a process with bash. Maybe is something with bash? > > > > Probably not, i don't see how bash could subvert the kernel... unless > something was broken. > > that, and another friend is complaining about problems. > > I'm beginning to suspect someone messed up sysctl because someone just > told me: > > "/usr/share/mk/bsd.port.mk", line 401: warning: "sysctl -n kern.osreldate" > returned non-zero status > > something weird with pcbs? i don't have time to track it down, and told > them to either ride out the problem (hoping someone takes notice) or cvsup > backwards one week and try that. I believe its got something to do with bash forking. Try; ps aux > foo ps aux | cat > foo ps aux | cat | cat > foo Notice that the number of "31Dec69" bash processes corresponds to the number of pipes. Also notice that the cat processes are not listed. I cannot duplicate this with sh or csh. I notice that pdksh will behave the same as bash. Pdksh and bash are dynamically linked while sh and csh are statically linked. I suspect that dynamic linking causes fork() to be "slower" thereby allowing a window of opportunity to see the shell listed in a ps listing before the process structures have been completely set up. This can be proven by: (sleep 1; ps aux) | cat | cat | egrep 'cat|bash' or (echo foo; ps aux) | cat | cat | egrep 'cat|bash' Notice that the "31Dec69" processes go away and ps now runs after the fork() has completed. Without looking at the kernel source (and one of the FreeBSD wizards can correct me here), I suspect that 4.4BSD is optimizing fork() by allowing the parent to continue to run without having completely set up the child while buffering output in the pipe until it is requested by the child. It is an optimum way to manage throughput, with a minor drawback. Interestingly enough dynamically linked shells don't exhibit this under Solaris, DUNIX, or Linux. Can this mean that 4.4BSD's fork() has better throughput than the others? If that's the case, it's probably a small price to pay. Regards, Phone: (250)387-8437 Cy Schubert Fax: (250)387-5766 Open Systems Group Internet: Cy.Schubert@uumail.gov.bc.ca ITSD Cy.Schubert@gems8.gov.bc.ca Government of BC To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message