[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Preemptive Multitasking and Pseudo-Forking
- From: "Peter Jacobi" <pjacobi.de@...>
- Date: Fri, 10 Oct 2008 11:45:44 +0200
Dear All,
This may be sort of a beginner's question and the topic may already be
discussed in the past
at length. In that case please just provide me with a pointer to these
discussion.
== Preemptive Multitasking ==
As far as I understand it, the Lua interpreter is fully reentrant and
running it in different (OS native)
threads -- of course with each thread having its own Lua state -- is
no problem at all. Of course
without further plumbing those threads would not have any
Lua-intrinsic means of
inter-thread-communication.
To prevent reimplementation of the wheel, has anybody written a module
to make this programming
model accessable from within Lua? Sort of "loadandrunstring_async"?
== Pseudo Forking ==
For the sake of operating systems which don't provide (efficent)
forking, 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?
Regards,
Peter