This is the classic BEAM VM (Erlang/Elixir) demo of spawning a million processes at once that do some work (in this case they just send a message back after a random amount of time from 0-2 seconds) and then garbage-collect themselves. I use the Erlang observer GUI to show you what happens. Note that the bottleneck here is the terminal's ability to keep up; see how quickly the memory and CPU utilization peaks and then dissipates in the observer.
The code that runs this is here: gist.github.com/pmarreck/4cc8...
16 июл 2023