lua-users home
lua-l archive

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


this is a recurring theme in my thoughts: how to do (efficient)
multitasking on Lua... with full data sharing between threads?  I
really don't like the several-spaces solutions (LuaLanes, LuaTask,
etc), because there's no nice and clean to pass complex data (like
deep tables, closures, coroutines, etc) around at will.

The only other solution is LuaThreads, but since it uses a single lock
for the whole main Lua Space, execution is almost completely
sequentialised, negating some of the benefits of multithreading in the
first place.

An obvious improvement might be to use finer locks, maybe one per
mutable object; but a pthread mutex lock weights between 40 and 64
bytes each.  way too much.  readers/writer locks are even bigger.

So, i'm exploring the opposite direction: lock-free structures.  so
far, i have a simple lockfree hashtable with similar semantics to Lua
tables.  I'd like to put it somewhere (LuaForge? this list? it's just
a 4.6kb tgz) to start some discussions.

it's still a very early work, has passed only some very naïve tests,
and has some obvious bottlenecks, and a few missing features (no array
part, for example).

any comments/ideas?