Node.js vs Erlang
Last Updated: 2022-02-12
- cooperative scheduling algorithm : the program explicitly yields the CPU for the next task
- same as old operating systems: MacOS 9, Windows 95 running legacy 16-bit code, MS-DOS and so on.
- advantages: easy to adapt existing languages and systems to the method; highly efficient in throughput; allows you to "pack" lots of work into a single process.
- weakness: if one of the tasks in the task queue monopolizes the CPU, hangs or blocks, then the impact is worse throughput, higher latency, or a deadlocked server.
- Erlang runtime:
- preemptively: An internal funcall counter measures "reductions" and once 2000 of these has been used, the process is forced off the CPU and the next one is switched in.
- same as modern time-sharing operating systems: UNIX, Windows NT+