[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is it possible to run Lua threads in OS threads safely?
- From: Norman Ramsey <nr@...>
- Date: Wed, 17 Jun 2020 16:06:52 -0400
> There seem to be a dedicated page on lua-users wiki:
> - *LuaProc *seems to be the official tool from Lua development Team
> (RI), but seems not to be maintained any more
> https://github.com/askyrme/luaproc, the original doc is
> http://www.inf.puc-rio.br/~roberto/docs/ry08-05.pdf, a more recent doc
> https://www.maxwell.vrac.puc-rio.br/30267/30267.PDF (seems to be about a
> 2018 modified version)
> - *Why in the user-lua wiki it is classified as "cooperative" and not
> "preemptive"?* (it enables but user-level and OS-level parallelism,
> so I guess it is cooperative at the user level and preemptive at the
> OS-level.... is this correct?)
> Does anyone has done some trial to assess pros/cons and performance?
I have been using luaproc for about three years.
- Relatively simple model
- Excellent speedups (basically 4x speedup on 4-core machine)
- Mostly reliable
- Scalar data is relatively easy to pass between threads (as upvalues)
- The concurrency model is a bit limiting, and it took me a while to
figure out how to use it effectively. (Details forgotten, alas.)
- Some code has to be written in strings, so you may not find syntax
errors as soon or as easily as you might like.
- To pass table values between threads, I wound up writing my own
- Occasionally a computation locks up on a mysterious way. Could
be luaproc or could be the C library we're using to interact with
the Unix pty interface.
On the whole I'd recommend it.