Erlang streams cannot be directly compared to Java operating system streams.
Erlang implements the concept of lightweight threads ( green threads ). In this case, in reality, the emulator can use a much smaller number of threads of the operating system.
The conceptual difference is that in erlang the flow, or as it is called in local terminology, the process is created for a small task that it solves. Thus, each process processes incoming messages using an internal state. Erlang thus implements the actor model .
It is necessary to compare erlang processes with actors on C #.
Operating system streams are usually not created in such a large amount. In the case of using threads to speed up calculations, their number is usually chosen in such a way as to provide the necessary level of load. In the simplest case, if the threads are not idle while waiting and it is necessary to fully utilize the system resources, the number of threads is chosen equal to the number of processor cores. To perform a large number of tasks in this case, use a pool of pots (thread pool). Tasks are distributed across this thread pool, and threads are not restarted.
Light streams can be created in much larger quantities, because in their case the runtime completely controls the flow and can interrupt it at predetermined locations, thus the costs of synchronization, saving and restoring the flow state are greatly reduced compared to the operating system threads.