[slime-devel] Re: Partial multiprocessing support on CMUCL

Luke Gorrie luke at bluetail.com
Mon Dec 15 07:47:30 UTC 2003


Luke Gorrie <luke at bluetail.com> writes:

> HELP, HELP! SAVE ME! I don't know how to write correct multithreaded
> programs!

Let me be slightly more specific. :-)

Here is a problem statement for the current implementation:

  Only one thread may read and evaluate requests from Emacs at a time.

  Initially a dedicated "Swank" thread does this.

  Emacs can ask the Swank thread to temporarily pass control of the
  socket to another thread. That thread then gets exclusive read
  access for the duration of a function call, and then returns control
  of the socket to the Swank thread.

The challenge is to implement this protocol using only the threading
primitives available. Those primitives are loosely defined as the
intersection of threading primitives in all Lisps that we want to
support -- CMUCL, SBCL, OpenMCL, LispWorks, ACL, and ideally keeping
an open mind towards others.

Can someone with experience comment on what that intersection is? So
far I have assumed it is "mutexes", but that doesn't seem
satisfactory. I haven't done thread programming in Lisp before.

Peter Siebel suggests using monitors. Now that I think about it, I
have already defined (SUSPEND-THIS-THREAD) and (RESUME THREAD)
primitives, which would be enough to build monitors with. Maybe that
is the way to go.

But before more hacking, I'd appreciate some words of advice on what
thread primitives we can reasonably assume the Lisps will support. Any
takers?

Cheers,
Luke






More information about the slime-devel mailing list