[comp.sys.mac.programmer] MF Schedule Assist proposal

jackiw@cs.swarthmore.edu (Nick Jackiw) (08/23/90)

What's wrong with this idea?

Every well-behaved multifinder application calls WaitNextEvent with a
tick-count that it's willing to sacrifice to other tasks before it needs
control again. Unfortunately, this is an absolute time, so its significance
depends entirely upon the number of tasks concurrently running.  

However, were there to be a "Load Balance" roster of ideal time slices
to allot each task (a percentage of the total time),  a routine could
easily be written that measured the amount of time a task was actually
getting compared to the ideal amount of time it should have.  A second
routine, a patch to WaitNextEvent, could then modify the amount of time
a task declares itself willing to sacrifice the next time it calls WNE.
If the task was consuming more cycles than allotted in the table, this
amount would be lengthened; if it wasn't getting enough, the amount
could be shortened.

Of course, user activities and uncooperative applications would tamper
with this synchronization, but nonetheless, over time, such a trap would
significantly harmonize the current tasks' loads with the ideal
distribution of CPU time.

Thus it shouldn't be that difficult to have some semblance of user based
scheduling.  If I'm unstuffing something I've just FTP'd off the net, and
want to read news while I wait, I put Stuffit in "background enabled"
mode.  Unfortunately, it's ridiculously slow; it must release 100 ticks to
every one it consumes.  My only other task at the time is netNews, which
certainly doesn't need 99% timeshare; so I double-click Scheduler, an
application which communicates with the WNE trap, and request 50/50
allocation between the two tasks.  Stuffit finishes in half the time.
Scheduling would be even more valuable with compilers which can work in
the background, with large database sorts, with raytracing renderers,
and any other compute-bound tasks.

So that's the idea.  Can anyone tell me off the bat why it's ridiculous?
(Save me some time...)  I'm not sure the degree to which I'd have to
play with Multifinder internals (and therefore not be compatible with
whatever, whatever---I'm willing not to be compatible across the eons on
this one).  Perhaps it could even be done with only "safe" techniques--
register and "know about" only those jobs who's name lurks in CurAppName
at the moment the WNE patch executes.

Comments appreciated. Thanks.



-- 
------------------------
Nick Jackiw		jackiw@cs.swarthmore.edu  "Every minute of the future
Visual Geometry Project	jackiw@swarthmr.bitnet     is a memory of the past."
Swarthmore College, PA 19081-1397				-Laivach