lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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