[comp.sys.apple] Multitasking, IIgs etc

wombat@claris.com (Scott Lindsey) (04/05/89)

OK, I've been giving the subject a bit of thought.  I think that a switcher-
like program could be written for the GS.  This might be a first step toward
a Multifinder.  I think these are the only directions really possible if you
want to maintain compatibility with existing desktop applications.  (No, I'm
not saying this just because of AWGS -- I'm approaching it from a Mac point
of view.)

In general, an implementation might work this way.  All switching would go
through GetNextEvent (since the GS doesn't have WaitNextEvent, it's not
quite possible to do Multifinder the way the Mac does).  The only things
that would have to be switcher aware (read: patched by the switcher) are the
Event Manager, the tool Locator, any FooStartup, FooShutdown where Foo is a
tool used by one of the applications and the memory manager.  Finally, NDA's
would have to be treated specially.

On a switch (say through clicking on an icon on the Menu bar) all allocated
memory in bank 0 would be swapped out (except, obviously, for the softswitches)
and the bank 0 info associated with the new app would be swapped in.  If we
assume well-behaved tools, all globals for a tool are on its direct page, so
we only have to worry about loading, starting up, and shutting them down
correctly.  NDA's are another problem.  Since there is only one copy of an
NDA around, it could not remain open across a switch (the window manager
wouldn't remember it :-), so we'd probably either not allow a switch when
NDA's are open or force a close of all before switching.


Obviously, these are just very rough ideas.  I'm open to comments.


-- 
Scott Lindsey     |"Cold and misty morning. I heard a warning borne in the air
Claris Corp.      |    About an age of power when no one had an hour to spare"
ames!claris!wombat| DISCLAIMER: These are not the opinions of Claris, Apple,
wombat@claris.com |    StyleWare, the author, or anyone else living or dead.

cs472226@umbc5.umbc.edu (David Wood (CS472226)) (04/05/89)

In article <9433@claris.com> wombat@claris.com (Scott Lindsey) writes:
>
>            NDA's are another problem.  Since there is only one copy of an
>NDA around, it could not remain open across a switch (the window manager
>wouldn't remember it :-), so we'd probably either not allow a switch when
>NDA's are open or force a close of all before switching.
>
   Do you HAVE to close the NDAs before swapping direct page
information? If the NDA is an entity in and of itself, you don't really
have to worry about losing information to a DPswap, and I don't know of
many NDAs that save information on an application's direct page.
   All you'd really have to do is save the windows' information and
handles, hide them (get them off the screen and sweep them under a rug
someplace), swap the direct pages, and open any new windows. Desk
accessories shouldn't even enter the picture.

   On another point, we're assuming that the applications that we start
under this theoretical multiple personality environment will follow
Apple's guidelines for tool use, memory requesting and allocation, etc.
I say don't worry. Any application that can't share memory with all the
others in the system shouldn't be allowed to play with them anyway. >:^)

                                                       -David Wood
   Help! This account turns into a pumpkin in May! Where and how can I
maintain contacts with UseNet?

blochowi@cat28.CS.WISC.EDU (Jason Blochowiak) (04/07/89)

	You mentioned the tool StartUp, and ShutDown, and such. But... First
off, what about HeartBeat tasks? What about vectors? What about the
softswitches? As an example of why the softswitches would have to be played
with: What if one application were running in 320 mode and another was in
640? (ok, so maybe that's not softswitches, but it's close :) Also, even if
the tools' DP areas were swapped, they can certainly allocate memory on their
own - are we sure they keep everything "based" in the DP? (e.g. The pointer
to the first window) Even if they do, mightn't they do a DisposeAll on an
AuxID under certain conditions? If they don't, how do we know they won't at
some point in the future? Oh, what about the DOC RAM? (and state)

	Sorry to sound so damned negative, but I've thought this through (I
do think it'd be nice to have at least a Switcher for the //gs), and it seems
as if there's just too much stuff to keep track of... The other thing is that
up to this point, switchEvt hasn't meant much - it's even ignored in Apple's
sample code, so it wouldn't seem that there'd be many apps that would do things
to be switcher aware.
 ------------------------------------------------------------------------------
		Jason Blochowiak (blochowi@garfield.cs.wisc.edu)
			"Not your average iconoclast..."
 ------------------------------------------------------------------------------