Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!scramble.lm.com!news.math.psu.edu!news3.cac.psu.edu!howland.erols.net!news.mathworks.com!uunet!news-in2.uu.net!news.maz.net!ins.net!heeg.de!hmm
From: hmm@heeg.de (Hans-Martin Mosner)
Subject: Re: Opinions of VW2.51
Message-ID: <DywCH7.2vJ@heeg.de>
Sender: uucp@heeg.de
Organization: Georg Heeg Objektorientierte Systeme, Dortmund, FRG
X-Newsreader: TIN [version 1.2 PL2]
References: <324A4C93.60A1@cs.tcd.ie> <01bbabb5$a49db5d0$663afbcc@peabody> <324B0EDC.3727@mail.amsinc.com> <01bbaee9$36902550$663afbcc@peabody> <changi0.9m.2CRNVw$072@zoe.pcix.com> <01bbafa1$ece77d90$663afbcc@peabody> <32534E0C.16FF@bmi.net>
Date: Mon, 7 Oct 1996 08:19:54 GMT
Lines: 35

Travis Griggs (tkc@bmi.net) wrote:
(Descrition of the Processor's mechanisms in general)
: ... Finally, I fork from my original process, a process at
: level 3 (the highest). The processor will immediately suspend the
: original process and begin work on this new high level process. At such
: time as this process yields control (again, either through suspend or
: termination), control will then fall back down to the processes at level
: 2. Which of the two processes actually gets control first, I have never
: really looked at. Does anybody else now the algorithm for determining
: which of processes at the same priority gets to run?

When a process is suspended by a higher-priority process, it is placed
in front of it's queue, so that it is run again when the higher-priority
process is suspended.
On the other hand, if processes are suspended by waiting on a semaphore
and then get resumed, they are put on the end of their queue.
This mechanism is used to implement a kind of cooperative multitasking
using 'Processor yield'. The implementation (from memory) is something
like this:

!ProcessorScheduler methodsFor: 'multitasking'!
yield
	"give control to other processes at the same priority"
	| sema |
	sema := Semaphore new.
	[sema signal] fork.
	sema wait

Hans-Martin

--
+--- Hans-Martin Mosner ---- Senior Smalltalk Guru :-) ---+
| These opinions are entirely ficticious.  Any similarity |
| to real opinions is purely coincidental and unintended. |
+--- <hmm@heeg.de> ------ URL:http://www.heeg.de/~hmm/ ---+
