|
|
|
|
|
by matheusmoreira
236 days ago
|
|
> The alternative is lightweight/green threads and actors. How lightweight should threads be to support high scale multitasking? Writing my own language, capturing stack frames in continuations resulted in figures like 200-500 bytes. Grows with deeply nested code, of course, but surely this could be optimized... https://www.erlang.org/docs/21/efficiency_guide/processes.ht... This document says Erlang processes use 309 words which is in the same ballpark. |
|
Erlang also enjoys quite a lot of optimizations on the VM level. E.g. a task is parked/hybernated if there's no work for it to perform (e.g. it's waiting for a message), the switch between tasks is extremely lightweight, VM internals are re-entrant, employ CPU-cache-friendly data structures, garbage collection is both lightweight and per-thread/task etc.