[Openmcl-devel] Coroutines/lightweight threads
Scott L. Burson
Scott at sympoiesis.com
Tue Nov 13 14:28:19 CST 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.
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel