[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Preemptive Multitasking and Pseudo-Forking
- From: Asko Kauppi <askok@...>
- Date: Fri, 10 Oct 2008 16:26:21 +0300
Lanes offers a multithreading framework for Lua.
Fabien kirjoitti 10.10.2008 kello 14:55:
== Preemptive Multitasking == [...]
To prevent reimplementation of the wheel, has anybody written a
module to make this programming model accessable from within Lua?
Sort of "loadandrunstring_async"?
I stitched together rings (for multiple states) and pluto (for data
serialization) some time ago. Rings is not intended for preemptive
multitasking, but you can probably adapt to luathreads or something
else with few adaptations:
wouldn't it be possible to emulate forking on the Lua level by
preemptive multitasking as described above? What would be needed is
cloning of a lua_State, so that both the original and the new thread
would have different but semantically equivalent states. Is there
prior art on this idea?
Yes, Mike Pall proposed some time ago a patch that lets serialize a
Lua thread. Together with coroutines, it gives you full
continuations, which among others allow to emulate process forking.
You can also take the idea and use Pluto for serialization, thus
getting a fine-grained control of what's shared or not between