Hacker News new | past | comments | ask | show | jobs | submit login

Maybe on the definition of "preemptive", but it should be treated as a preemptive VM in practice.



Nah. You can screw with the BEAM’s reduction-scheduling even in pure Erlang code: just write a really long function body consisting only of arithmetic expressions (picture an unrolled string hash function.) Since it contains no CALL or RET ops, the scheduler will never hit a yield point, even after going far “into the red” with the current process’s reduction budget.

You just never see this in real Erlang code, because who would code that way? If you want to be idiomatic, use recursion. If you want to be fast, use a NIF. Why ever use an unrolled loop body?

But it can happen, and therefore, the BEAM does not guarantee preemption, even in Erlang. Reduction scheduling isn’t a “kind of” preemptive scheduling. It’s its own thing.


I mean, like i said, it should be treated as a preemptive VM in practice. In reality its not, but for most practical cases, its easier to understand it terms of preemption.


As a developer, yes. As an ops person trying to figure out why your deployed release isn’t making its deadlines, no.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: