Pre-emptive vs. Cooperative Multitasking

Billy Tanksley
Thu, 27 Jul 1995 20:05:15 -0700 (PDT)

On Fri, 28 Jul 1995, Francois-Rene Rideau wrote:

> > I'll have to take a look-- it doesn't make any sense how calling any 
> > function could not take time.

>    Because the function is not actually called ! Instead, code is modified at
> some point by the interrupt-driven routine that decides of a schedule...

I would call that preemptive.  However, it's a very clever preemption, 
achieving almost all the benifits with almost none of the losses.  I 
think it highlights the fact that we are in agreement.

(When I first saw that phrase "code is modified" I nearly choked-- after
all, I've been trained to never (seldom) write self-modifing code.  It's a
good thing I taught myself a few bad habits before the teachers got to me,
or I probably wouldn't have recognised that that's precisely what we're 
developing our language as!)

> > I think we're operating on mixed wavelengths, possibly.  I'm not an 
> > anarchist, in code or otherwise; I simply see tasking as the domain of 
> > the superobject (known by some OSes as the kernel).

>    We do not disagree. Only as I see things, there is no reason why the
> object and the meta-object should communicate between each other through
> a static "black-box" mechanism, while on the contrary, having data from
> the context being spread in the implementation of the object leads to
> increased performance.

Our only disagreement was in words.  I accept your nomenclature as being 
superior and more useful for this project.

> > In fact, one possible scheme that I think would fit with TUNES is to have
> > each object depend upon its superior for computing time.  That way you
> > don't need a huge central authority-- only big enough to apportion power
> > among the topmost objects.  You could have some object types that
> > delivered power preemptively, others that depended upon cooperation
> > exclusively.
>    That's one way to do scheduling that I appreciate indeed.

Here's an elaboration: how about if all power, both computing and 
otherwise, is passed down a hierarchy of objects?  In order to recive 
computing time an object must be attached to a power-providing object 
(perhaps the clock, perhaps some other object attached to the clock), and 
in order to be visible an object must be attached to a vision-providing 

Some computational objects would be miserly, granting power only to 
relinquish it quickly (the essence of preemptiveness), while others would 
simply give power to the next object on their list and take it back only 
when asked to.

> >>    Cooperation is to follow laws, to increase information. It does *not*
> >> oppose preemption. It opposes absence of cooperation, which is anarchy.

> > I support preemption.  I do not oppose cooperation.
>    I think we agree. Our divergences were in point of view, not in opinion.

Or better yet, in choice of words.  I think we see things similarly.

> > Does TUNES have a motto?  (Or was that it in your .sig that I just 
> > deleted?)  If not, may I suggest "rem non spem, factum non dictum", 
> > meaning (in its original context) "an action, not hope; facts not speech", 
> > but better translated here as "an object rather than a procedure, a fact 
> > rather than a word".
> > The first part will serve to show others what the OS is-- a fully OO 
> > system.  The second will keep reminding us what to do about it.  Sorry, I 
> > forget the source for this quote, but I'll look it up if you feel you can 
> > use it.

>    I fear that TUNES is a motto in itself. However, the LLL subproject does
> not have a motto, and yours suits it very well; would you mind if this becomes
> the motto for the LLL subproject instead ?

I'd be honored-- and I can't help but chuckle at the appropriateness.  I
wish I'd thought of it.  Ok, I just searched my books for the source of
that, but I can't find the derivation.  It's either original to the
authors of the book or they've violated some long-dead Roman's copyright. 
Hmm, I wonder which? 

The full quote (which wouldn't work as a motto) is "Rem non spem, factum 
non dictum, quaerit amicus."  The book translates it as "A friend seeks 
support, not promises; action, not talk."  The book, by the way, is Artes 
Latinae, level 1, book 1, by Waldo E. Sweet (Encyclopedia Brittanica).