Skip to: Site menu | Main content

Groovy Parallel Systems

Actor Print

The actor support in gpars were inspired by the Actors library in Scala but have meanwhile gone beyond that.

Actors allow for a messaging-based concurrency model, built from independent active objects that exchange messages and have no mutable shared state. Actors can help solve or avoid issues like deadlocks, livelocks or starvation, so typical for shared memory.

A nice wrap-up of the key concepts behind actors was written recently by Ruben Vermeersch

Actors Inside

Actors can share a relatively small thread pool. This can go as far as having many concurrent actors that share a single pooled thread. They avoid the threading limitations of the JVM.

Actor code is processed in chunks separated by quiet periods of waiting for new events (messages). This can be naturally modeled through continuations. As JVM doesn't support continuations directly, they have to be simulated in the actors frameworks, which has slight impact on organization of the actors' code. However, the benefits in most cases outweigh the difficulties.

example by Jordi Campos i Miralles, Departament de Matemàtica Aplicada i Anàlisi, MAiA Facultat de Matemàtiques, Universitat de Barcelona

Usage of Actors

For more details on Actors visit the Actors section of the User Guide.

Please also see the numerous Actor Demos.