From owner-freebsd-questions Sun Feb 14 16:33:03 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA04685 for freebsd-questions-outgoing; Sun, 14 Feb 1999 16:33:03 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from implode.root.com (root.com [208.221.12.98]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA04680 for ; Sun, 14 Feb 1999 16:33:02 -0800 (PST) (envelope-from root@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.8/8.8.5) with ESMTP id QAA14048; Sun, 14 Feb 1999 16:31:27 -0800 (PST) Message-Id: <199902150031.QAA14048@implode.root.com> To: "Masahiro Ariga" cc: freebsd-questions@FreeBSD.ORG Subject: Re: Please untangle my brain. In-reply-to: Your message of "Mon, 15 Feb 1999 03:12:27 +0900." <000301be5845$ba8022e0$064ca8c0@gateway> From: David Greenman Reply-To: dg@root.com Date: Sun, 14 Feb 1999 16:31:27 -0800 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >And made it run,expecting the output should be as follows, >This is child! num=0 >This is parent! num=0 >This is child! num=1 >This is parent! num=1 >and so on,but instead the actual output was as follows. > >This is child! num=0 >This is child! num=1 >This is child! num=2 >This is child! num=3 >This is child! num=4 >This is parent! num=0 >This is parent! num=1 >This is parent! num=2 >This is parent! num=3 >This is parent! num=4 > >I am puzzeled.Why in the world this could happen,what was going in >UNIX?Please someone untangle my mystified brain. As in most multi-tasking systems, FreeBSD processes usually run for a quantum (or "time slice") before switching to another process. The length of the quantum in FreeBSD is 100ms. How long a process runs when there are other running processes is more complicated than just the quantum, however, since there is also a sophisticated priority queueing mechanism that biases the running of 'interactive' processes over compute bound processes. It's not my intention to get deeply into the details here of how it all works - just to explain why the output was as you've observed it above. -DG David Greenman Co-founder/Principal Architect, The FreeBSD Project To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message