[Openmcl-devel] Coroutines/lightweight threads

Scott L. Burson Scott at sympoiesis.com
Tue Nov 13 12:28:19 PST 2012


On Mon, Nov 12, 2012 at 11:45 PM, Alex Mizrahi <alex.mizrahi at gmail.com>wrote:

> If I understand correctly the whole point of lightweight threads is that
> they are more lightweight than native threads. Thus having 1 native thread
> for each 1 lightweight thread kinda defeats the purpose.
>

Right :-)


> I wonder isn't it possible to implement it completely on user level, via
> closures, closure-passing-style transformation or something like that.
>

It is indeed possible, and has been done (cl-cont for example).  But the
resulting object code is rather slow, as it heap-allocates all
continuations (which would normally be stack frames).

Perhaps the best portable approach would be a CL -> CL precompiler that
would generate code that would use an explicit stack that would be kept in
a chained sequence of simple-vectors in the Lisp heap.  I started to work
on this at one point, but didn't get far.

-- Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20121113/ca3b1e09/attachment.htm>


More information about the Openmcl-devel mailing list