3 ms·
Deep Diving into the Erlang Scheduler
- alakra 2y agoSomewhat related, does anyone know the difference between `erlang:suspend_process` and `sys:suspend` when trying trying to "unschedule" a process for executing reductions? Are they the same thing?
- yetihehe 2y agosys:suspend is more low-level. erlang:suspend_process is also tracking which processes suspended a process, so you can suspend from multiple places and if all suspending processes terminate, it will automatically unsuspend the suspended one. Probably erlang:suspend_process uses sys:suspend when counter is >1 and sys:resume when counter reaches 0.
- uticus 2y ago> The idea of "reduction" in Erlang is inherited from its Prolog ancestry. In Prolog, every execution step is termed a goal-reduction, involving breaking down a logic problem into individual components and solving each part accordingly. > To promote fairness among processes, Erlang's preemptive scheduling relies on reductions rather than time slices. If a process exhausts its allocated reductions, it can be preempted, even if its execution isn't complete. Fascinating