3 ms·
Erlang loops will not block the OS thread because the BEAM VM implements preemptive multi-tasking at the (green) process level.
by jeremyjh 12y ago
Erlang loops will not block the OS thread because the BEAM VM implements preemptive multi-tasking at the (green) process level.
- felixgallo 12y agoNot quite. BEAM implements a cooperative multitasking environment using reductions that are checked at function calls. In practice you will rarely write code that runs forever without calling a function or returning, but it's possible, especially if you use NIFs. This will generally cause scheduler collapse and result in all sorts of weird problems, so in the most recent version of the BEAM, there's 'dirty scheduler' support so that you can work around that problem if you have native code that runs for a long time (> 1 ms). A good primer on all of this is http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-scheduling.html http://jlouisramblings.blogspot.com/2013/01/how-erlang-does-....