|
|
|
|
|
by dozzie
3972 days ago
|
|
> [...] but you can have those millions of processes on the JVM, too [...] In theory, yes. In practice, it's very difficult. JVM thread corresponds to
a thread of host OS. Spawning and keeping those is very slow and expensive
compared to Erlang's processes. You could have a pool of pre-spawned workers,
but suddenly you can't spawn a worker for each connection and hope it will all
work; you need to manage the pool. You also could try to implement green
threads in JVM, as they are in Erlang, but you would need an entirely new
compiler to insert yield points at appropriate places, or else you would get
exactly the same problems with green threads as everywhere else. Under JVM you just don't spawn a thread for each and every activity, because
you would choke your system. The whole point of developing Erlang was to allow
exactly this programming style in a manner safe against processing
congestion. |
|
I am talking about a new compiler. An Erlang compiler. The JVM is a virtual machine. Erlang is a language. We've already proven you can run Erlang on the JVM quite well, and that was before many pertinent improvements to the JVM and its ecosystem.