[hunchentoot-devel] Finding out if we're multithreaded
Hans Hübner
hans at huebner.org
Sat Feb 16 10:30:54 UTC 2008
CMUCL does not have threads. It does have multiprocessing based on
SERVE-EVENT which is implemented in the Lisp runtime, as opposed to
Lisp with threads that uses platform (often POSIX, but sometimes also
Win32) threads to implement Lisp multiprocessing. The distinction is
important because in a threaded Lisp, the scheduler is typically
implemented in C as part of the system threads library, whereas in
CMUCL, the scheduler is implemented in Lisp. Both approaches have
advantages and disadvantages. The major advantage of Lisp processes
implemented as native threads is that scheduling can occur while a
Lisp process is executing foreign code, whereas with a Lisp scheduler,
entering a foreign function will prevent scheduling. Also, Lisp
multiprocessing with native threads (theoretically) allows for
symmetric multiprocessing within one Lisp process, although many
implementations do not support that. Contrasted to that, Lisp based
multiprocessing on CMUCL is cooperative (processes are not
interrupted, but they may yield to allow scheduling of other
processes) which simplifies some applications. Also, as the scheduler
runs in Lisp, it is possible to call Lisp functions from the
scheduler, which makes it easy to implement queues and other
multiprocessing synchronization mechanisms that, with native
threading, require the use of system-defined primitives.
For many applications, cooperative multiprocessing is easier to work
with as there are fewer hazards. Processing is synchronous, and
processes do not need to worry about being rescheduled unless they
voluntary give up control (either by sleeping, waiting for I/O or
explicit yield). I had great success with running web and general
event processing servers on CMUCL with portableaserve as HTTP server.
I would like to see Hunchentoot support CMUCL in the future and will
put some effort into testing it with the upcoming cmucl-19e release.
-Hans
On Feb 16, 2008 10:55 AM, Edi Weitz <edi at agharta.de> wrote:
> On Sat, 16 Feb 2008 02:06:04 -0500, "Vyacheslav Akhmechet" <coffeemug at gmail.com> wrote:
>
> > There's also OpenMCL running on intel chips. It might have support
> > for threads now (I am not sure), but at some point quite recently it
> > didn't.
>
> There's also CMUCL on some architectures. But your question was about
> Hunchentoot. I'm pretty sure Hunchentoot won't even compile on
> OpenMCL/CMUCL without threads.
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
More information about the Tbnl-devel
mailing list