ERLANG wait() and blocking

The process which executes that code will block, the scheduler which runs that process currently will not block. The code you posted is equal to a yield, but with a timeout.

The Erlang VM scheduler for that core will continue to execute other processes until that timeout fires and that process will be scheduled for execution again.


Short answer: this will block only current (lightweight) process, and will not block all VM. For more details you must read about erlang scheduler. Nice description comes from book "Concurent Programming" by Francesco Cesarini and Simon Thompson.

...snip... When a process is dispatched, it is assigned a number of reductions† it is allowed to execute, a number which is reduced for every operation executed. As soon as the process enters a receive clause where none of the messages matches or its reduction count reaches zero, it is preempted. As long as BIFs are not being executed, this strategy results in a fair (but not equal) allocation of execution time among the processes. ...snip...

Tags:

Erlang

Wait