Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!psuvax1!rutgers!cbmvax!valentin From: valentin@cbmvax.commodore.com (Valentin Pepelea) Newsgroups: comp.sys.amiga.tech Subject: Re: Task Switching Problem Message-ID: <14593@cbmvax.commodore.com> Date: 21 Sep 90 22:08:05 GMT References: <1990Sep21.180100.28580@uncecs.edu> Reply-To: valentin@cbmvax.commodore.com (Valentin Pepelea) Organization: Commodore, West Chester, PA Lines: 33 In article <1990Sep21.180100.28580@uncecs.edu> utoddl@uncecs.edu (Todd M. Lewis) writes: > > * how does one get the currently running task to relinquish > the CPU for the rest of the current time slice? I want to > have a task which will increment a counter each time it is > activated, then sleep until its turn to run comes up > again. There used to be function call available that allowed a task to relinquish the CPU to some other ready task, but that function has been made private. I was not part of the devellopment team back then, so I cannot comment on the rationale of this move for sure, but I can give you my own rationalisation. The proper way for tasks to synchronize is through signalling and waiting. The availability of a Relinquish() call would incite novice programmers to create their own cooperating multitasking environment rather than taking advantage of the inherent preemptive characteristics of the operating system. The net result is that the abusive use of a Relinquish() call would amount to busy waiting. A task would check for the occurrance of an event, and call Relinquish() if that event did not happen yet. When awaken again, it would loop back to check for the occurrance of the event, and call Relinquish() if the event did not occur yet. This kind of programming practice must be avoided. The proper thing to do is to make the Relinquish() call unavailable. Valentin -- The Goddess of democracy? "The tyrants Name: Valentin Pepelea may distroy a statue, but they cannot Phone: (215) 431-9327 kill a god." UseNet: cbmvax!valentin@uunet.uu.net - Ancient Chinese Proverb Claimer: I not Commodore spokesman be