A few examples on Actors use
Examples
- Sleeping Barber
- Dining Philosophers
- Word Sort
- Load Balancer
Sleeping Barber
Dining Philosophers
Word sort
Given a folder name, the script will sort words in all files in the folder. The SortMaster actor creates a given number of WordSortActors, splits among them the files to sort words in and collects the results.
Inspired by Scala Concurrency blog post by Michael Galpin
Load Balancer
Demonstrates work balancing among adaptable set of workers. The load balancer receives tasks and queues them in a temporary task queue. When a worker finishes his assignment, it asks the load balancer for a new task.
If the load balancer doesn't have any tasks available in the task queue, the worker is stopped.
If the number of tasks in the task queue exceeds certain limit, a new worker is created to increase size of the worker pool.