Date: Sun, 14 Feb 1999 16:31:27 -0800 From: David Greenman <dg@root.com> To: "Masahiro Ariga" <mariga@cd.mbn.or.jp> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Please untangle my brain. Message-ID: <199902150031.QAA14048@implode.root.com> In-Reply-To: Your message of "Mon, 15 Feb 1999 03:12:27 %2B0900." <000301be5845$ba8022e0$064ca8c0@gateway>
next in thread | previous in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902150031.QAA14048>