O'Reilly logo

Actors in Scala by Frank Sommers, Philipp Haller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.2 Managed blocking

The actor runtime system uses a thread pool, which is initialized to use a relatively small number of worker threads. By default, the number of workers used is twice the number of processor cores available to the JVM. In many cases, this configuration allows executing actors with a maximum degree of parallelism while consuming only a few system resources for the thread pool. In particular, actor programs that use only event-based operations, such as react, can always be executed using a fixed number of worker threads.

However, in some cases, actors use a mix of event-based code and thread-based code. For instance, some methods like receive are implemented using thread-blocking operations. Moreover, actor-based code may have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required