4 ms·
No, Scala and Erlang don't allocate pthreads. Their threads are also lightweight and in-system.
by atemerev 11y ago
No, Scala and Erlang don't allocate pthreads. Their threads are also lightweight and in-system.
- shikhar 11y agoJVM threads map to native threads
- kasey_junk 11y agoThat's true but there is some nuance here because you can use the JVM fork/join executor service & see behavior similar to coroutine's.
- masklinn 11y agoUnclear wrt Scala, jakozaur asserts the bench does use pthreads. Erlang does use lightweight processes, but the configuration isn't tuned for high creation/destruction throughput: on my system, the smallest possible process is 333 words, or 2.5Kb (control structures, default stack and default private heap)
- dtech 11y agoAre you sure about scala? I would assume it just uses JVM threads, which map to OS threads on most modern implementations.
- atemerev 11y agoYes, I am sure. M:N dispatcher is used here. http://doc.akka.io/docs/akka/2.4.1/scala/dispatchers.html http://doc.akka.io/docs/akka/2.4.1/scala/dispatchers.html
- emergentcypher 11y agoScala runs on JVM and uses the same OS-level threads. What's going on here is the actors are being scheduled to run on a thread pool.
- emergentcypher 11y agoScala does not have lightweight threading. It uses the same thread pools from Java. All your millions of Actors are scheduled onto one of these thread pools.
- rozap 11y agoWhich means you need to program with futures in order to not do blocking IO on your limited thread pool that the actors are multiplexed across. So at that point you need to write node.js style code. Coming from an Erlang world to akka, this blew my mind.