[erlang-questions] nif driver c code must be reentrant?
Sat May 25 12:14:42 CEST 2013
I'm not entirely sure how this function works but the implementation
of bump_reductions seems to cap the reduction bump to CONTEXT_REDS
One place I've seen reductions calculated is in sending distributed
messages which suggests that the CONTEXT_REDS threshold is only
specific to erlang:bump_reductions/1. Though I'm also not sure if
there's a reason to bump more than 2000.
Also, I've been wondering lately if anyone had tried erlang:yield/0 to
address the NIF problem on newer Erlang versions. Most of the stuff I
work on is still on R14 so I haven't had to invest much time in
addressing the reductions issue but forcing a yield seems to be mostly
what people are trying to accomplish with maybe a bit less than a
yield for smaller operations.
On Tue, May 21, 2013 at 7:13 PM, Scott Lystig Fritchie
> Dan Gudmundsson <dangud@REDACTED> wrote:
> dg> [...]
> dg> erlang:bump_reductions(1000000)
> dg> [...]
> Dan, that prompts a good question that has been bugging several people
> (including me). Does this 1 million reduction count bump have an effect
> more than a 2000 reduction bump? IIRC, a process is scheduled out after
> 2000 reductions. And my (poor) memory says that the reduction count
> starts at 2000, that count is decremented, and a scheduling decision is
> made when the reduction count goes negative.
> Does it really make a difference if the count goes negative by a little
> (e.g., only one) or by a lot (e.g., 999,990)?
> erlang-questions mailing list
More information about the erlang-questions