[comp.emacs] multi-tasking

jr@bbn.com (John Robinson) (06/06/90)

In article <CIMSHOP!DAVIDM.90May28184707@uunet.UU.NET>, cimshop!davidm@uunet (David S. Masterson) writes:
>Might I suggest expanding this into "How can Emacs best make use of the
>multi-tasking environment of a windowing system?"

As others have said, multi-tasking is a separate issue to this
discussion, but interesting noetheless.  It is more of an OS issue
than a windowing issue.

I can see three levels at which multi-tasking might operate.

1.  Emacs can spawn tasks asynchronously.  This already exists.  Emacs
can let the tasks run and not await their return.  (Difference between
start-process and call-process).  mh-e actually uses this to let you
go on with emacs before a send command has completed.  Works well when
the other process is IO-bound.

2.  Like 1, but more support is built-in.  What I have in mind is
something like:

.   the command loop continues to run, until the user either (1) tries
    to modify the buffer the process output is aimed at, or (2) does
    another call/start-process in this buffer.  [Note that emacs
    thinks of processes as being bound to buffers].  I probably forgot
    some cases that have to block.

.   If the user goes to another window, then these rules apply
    relative to that window's buffer's process.

.   [in a window system] if user goes to another window, ditto.

Note that this is helpful on good ol' ascii terminals.  (Can you say
emacs with job control?)

3.  More ambitious: emacs allows you to do things like 2 in the middle
of long emacs commands.  This would require a total reorganization of
the dispatch loop, perhaps with a scheduler, etc.  The interlocking
would be trickier.  Should the user be able to have two emacs
functions running on one buffer?  shared memory, or a separate Unix
subprocess per buffer?  At this point, I believe that emacs is doing
more than is its proper role - it can be an editor and a shell (with
job control!), but I don't think it makes sense to have it be the
operating system as well.  Yet a plausible argument could be made
given a simple enough design... (but note that Unix in general doesn't
support shared memory, so it would be tricky pausing and resuming the
subprocesses at the right times to get the terminal/window system I/O
to work out right...emacs has to be a window-manager as well?).  Also
there are the same issues Epoch has about one or more minibuffers,
kill-rings, command-histories, etc.

A possible simulation of this style of operation is to run two (or
more) emacses inside terminal-mode windows.  Anyone want to try this
hack?
--
/jr, nee John Robinson     Life did not take over the globe by combat,
jr@bbn.com or bbn!jr          but by networking -- Lynn Margulis