lua-users home
lua-l archive

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


Javier Guerra wrote:
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.

I would be interested to see it. As tables are used throughout Lua for all tasks may actually be feasible. The GC's atomic phase would still have to block, as it traverses the stack, but other then that lockfree tables may well work. Does even len work? I suppose the only real concern would be speed (quite a big concern) and possibly table size...

About locks though, they can be just a single bit if there's no need to nest them (there shouldn't be any need in Lua), so it may still be worth trying that approach too.

And later versions of LuaJIT may take a third approach: http://lua-users.org/lists/lua-l/2008-02/msg00051.html
(Only lock when needed)

- Alex