Actor Models (Xy Ziemba)

Readings:

Read http://en.wikipedia.org/wiki/Actor_model

Sections:

1. History

2. Fundamental concepts

4. Applications

5. Message-passing semantics <-- skim this one

Reading Questions:

    1. What inspired the Actor model? What aspects of the model remind you of this inspiration?

    2. What other forms of handling concurrency are you aware of? Are actors higher or lower level than these forms?

    3. What changes in computation might make the actor model more relevant today?

    4. What does an actor receive?

    5. What can an actor do once it has received a message?

    6. Is an actor stateless?

Lecture notes:

What's wrong with threads?

    • Implementation varies with the platform

    • Deadlocks can occur

    • Not necessarily appropriate for distributed systems

What is the actor model?

    • Everything is an actor

    • Actors have state

    • Actors send and receive messages

    • Actors can create new actors

Why do we care about the actor model?

    • Distributed computation is rapidly becoming more relevant.

    • Actor models allow us to abstract distributed, multi-threaded processes away from a machine. (In effect, we can analyze these processes more theoretically.)

In class activities:

Quiz questions:

    1. Using Pykka, create a network of actors which distributes work for an arbitrary function "PythonPackage.hard_problem()"

    2. Explain, in English, how this network of actors distributes the workload.

    3. Explain what sort of problem you're optimizing for. What characteristics of PythonPackage.hard_problem() might make your actor structure appropriate? What characteristics might not?

Homework exercise:

Use the BinaryActor created in class to balance a hypothetical load tree. Your main function should generate variable amounts of time to pause a thread for. (Higher time is simulates a higher load.) This value should be passed down the tree and allocated to the leaf with the smallest backlog. You will have to send messages up and down the tree to update work backlogs.