lua-users home
lua-l archive

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


Hello Philippe:

Did I do something which deserves this top-posted reply?I seem t
orecall it wasn't your style. Anyway.

On Mon, Mar 11, 2019 at 1:26 PM Philippe Verdy <verdy_p@wanadoo.fr> wrote:
> I do not want a "replacement",

My fault, it seem you wanted that.

> just the possibility to convert coroutines as plain threads.

This eliminates one / several of the advantages of coroutines, unless
you do it in a very restricted way. Normally what you do is having a
process composed of threads composed of coroutines.But a coroutine in
a thread is a different beast.

> I do not contest the interest of coroutines, basically for implement the producer/consumer model within the same app,

mmm, this, specifically, is quite well served by threads. I mean,
everytime I've done it I got just a sync point, a queue of consumable
items, or two, a queue of consumed items to refill. Threads work fine
there and are advantageous if you wan to customize fan in/fan out.

> but not for handling services between different users or diffeernt security contexts.
or for multicore mandelbrot set calculations. But specifically, in
Lua, given how cheap states are, you can specifically solve that
problem easily, and probably better, using several interpreters. After
all, running several "security contexts" in a single memory space ( at
the lua level ), is complicated ( in fact, not from a performance but
from a security point of view, coroutines, which do not have races,
may be better ).

Francisco Olarte.