From: andrew@cubetech.com
Subject: Re: the NeXT option (Was Re: 7.1 vs. OS/2 and Windows NT)
Organization: Cube Technologies, Inc.
Date: Thu, 5 Nov 1992 07:53:15 GMT

In article <_+f1tvp@rpi.edu> johnsd2@rpi.edu writes:
>In article <ewright.720722961@convex.convex.com>, ewright@convex.com (Edward V. Wright) writes:
>|> In <acb18_+@rpi.edu> johnsd2@vccnw03.its.rpi.edu (Daniel Norman Johnson) writes:
>|> 
>|> >I was talking about the cases in which co-operative mt would work *well*,
>|> >such as when there are no background tasks chewing up all the cpu time...
>|> 
>|> >I merely mistyped. Put down the flamethrower this paragraph. The
>|> >new version makes a bit more sence know? Incidentally, before you
>|> >jump to the wrong conclusion, by "background tasks" I mean 
>|> >tasks that are actually DOING something, not idling.
>|> 
>|> Cooperative multitasking works well when there are background
>|> tasks "chewing up all the CPU time" as well.  I have downloaded
>|> files in the background on many occassions and never experienced
>|> the chronic problems you talk about.
>|> 
>
>That's nice. Its dubious that this is "chewing up all the CPU
>time", but that's not terribly important.
>
>However, co-operative mt is decidedly less efficient in these
>cases- efficient enough to do downloads, but it could be better.

That is totally false.  cooperative multitasking is _always_ more
efficient than premtive MT, *especially* when you have many threads
and the load is high.  Why?  There is far less overhead in a
cooperative MT system.  One thread simply calls the yield function,
the kernel sticks that thread at the end of the run-queue, and begins
executing the thread at the head of the run-queue.

NetWare is a multithreaded operating system.  But it's cooperative mt,
and has no memory protection (much like a macintosh).  Threads must
call ThreadSwitch() to yield the processor.  Novell reccommends that
you call it *often.*

NetWare is mainly a file-server operating system, and it's very highly
optimized for speed.  In fact, cooperative mt and no memory protection
or virtual memory space was specifically chosen because it was more
efficient.  Novell licenses NetWare based on the number of concurrent
users.  It starts at 100 users and goes up to 1000 (one thousand).
Would you put even 50 users on one AppleShare file-server?  Forget
file-serving.  If you had enough memory, would you run 50 pieces of
software at once on a Mac assuming that 5 at any one moment would be
using the processor to do something?  Heck, I can cause a download to
fail on a Macintosh by just using one application!

The difference is on a file server, you run much less software (as in
different pieces from different places rather than the number at once)
than you would on a PC like a Macintosh.  For instance, you might run
a few pieces of software from Novell (like NFS or AppleShare), maybe
some UPS software, and possibly a database server from Oracle or
Sybase.  But not a whole lot more.

On a Macintosh you run all sorts of software coming from all sorts of
people and companies, and Macintosh software isn't required to go
through testing by Apple before the company can claim it's Macintosh
compatible (like you have to do with NetWare Loadable Modules).

The problem isn't that cooperative MT isn't efficient, it's that the
software isn't yielding the processor often enough.  I think part of
the problem is that the thread yield functions on Macintosh are
directly tied to the event dispatcher.  So you have software that
isn't yielding the processor until it's done doing whatever it's doing
and is ready to process the next event.  Mainly because in many
situations, it's very difficult to process more events and continue
doing whatever it was that you were doing.  It's all this between
event processing that's the problem since it blocks all the other
tasks.  On a preemtive MT system, the application can spend as much
time as it wants processing in between events without blocking other
threads.

The bottom line is that cooperative mt is definitely more efficient
that preemptive mt, but preemptive mt is far more _appropriate_ in a
user environment where you can't count on every application to be a
"good-guy" and yield the processor often.  This is why unix, and VMS,
and VM, and MVS, and so on are all preemptive - they are designed to
be used directly by users.


andrew
-- 
andrew@cubetech.com     | "Carpe Nocturn - I get more work done after
Andrew Loewenstern      |  2 a.m. than most people do all day."
Cube Technologies, Inc. |                          - Simson Garfinkle

Newsgroups: comp.sys.mac.advocacy