[erlang-questions] Erlang/OTP 18.0 has been released

Steve Vinoski vinoski@REDACTED
Fri Jun 26 18:00:39 CEST 2015

On Fri, Jun 26, 2015 at 9:03 AM, Max Lapshin <max.lapshin@REDACTED> wrote:

> Is the patch by Steve Vinosky included in this release?


We still experience big problems with dirty schedulers on 17.4 in our
> ffmpeg needs.

My patch for the problem you saw (commit b7c9657) was never applied to
17.x, though it could be if the OTP team wanted to do that. But it is
included in 18.0. Are you seeing similar problems with 18.0?

> By the way, it seems to be very uneasy to enable  runtime switch between
> dirty and non-dirty schedulers in NIF, because it requires
> expanding ERL_NIF_INIT macro. Is there any easy way to do it?

Dirty schedulers don't affect the ERL_NIF_INIT macro, but I think what
you're referring to is the ErlNifFunc struct type, which was extended with
an extra flags field for dirty schedulers (and perhaps other future uses).
But you need not use that flags field to specify dirty scheduling -- you
could instead specify in your ErlNifFunc a regular nif that schedules the
call over to a dirty scheduler at runtime by checking enif_system_info,
like this:

    ErlNifSysInfo si;
    enif_system_info(&si, sizeof(si));
    if (si.dirty_scheduler_support)
        enif_schedule_nif(env, "dirty_nif", ERL_NIF_DIRTY_JOB_CPU_BOUND,
dirty_nif, argc, argv);
        /* run the function as a regular NIF or in your own thread pool */

This is slower than using the flags field, but the overhead is in the noise
for typical applications.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150626/89da2704/attachment.htm>

More information about the erlang-questions mailing list