[erlang-questions] How long a NIF can block the Erlang BEAM?

Scott Lystig Fritchie <>
Tue Nov 23 18:37:14 CET 2010


Kenji Rikitake <> wrote:

kr> The enif_thread_create() and enif_send() pair Alceste wrote looks
kr> very interesting, though I also guess it's a bit too complicated for
kr> a random number generator.

Kenji, if creating and joining new Pthreads is overkill, there's another
"you must be joking" way: just increase the number of scheduler threads.
The "erl +A" flag is just waiting to be (ab)used this way.  :-)

If you needed to avoid having too many of these running at one time, and
each one is going to run for 10s or 100s of milliseconds (or more), then
writing a simple gen_server to provide a rate-limiting/admission-control
mechanism would have relatively zero overhead.

-Scott


More information about the erlang-questions mailing list