lua-users home
lua-l archive

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

Hi Oliver,

> This takes care that send() will give other coroutines a chance to run, which is good as otherwise one coroutine may send all the time and no other can be resumed.
> But why is this behaviour coupled to a probabilistic value?

I think it's mostly for convenience. If you want to say "try this no
more than 10 times", you need to keep the state somewhere (that you
already tried X times). Using probabilistic approach gives you a
somewhat similar result without the need to keep any state. It's also
possible that stochastic behavior produces better overall result for
the system (for example by reducing the total wait time for pending
requests), but I don't recall seeing any numbers on this.