Before starting:

This notebook is meant to be used as slides.

Evaluate the following cell to convert it to html:


In [6]:
!ipython nbconvert --to slides Introduction.ipynb --SlidesExporter.template_file=slides_template.tpl


[NbConvertApp] Using existing profile dir: '/Users/walter/.ipython/profile_default'
[NbConvertApp] Converting notebook Introduction.ipynb to slides
[NbConvertApp] Support files will be in Introduction_files/
[NbConvertApp] Loaded template slides_template.tpl
[NbConvertApp] Writing 201940 bytes to Introduction.slides.html

Evaluate the following cell to start a server with the generated slides:


In [2]:
PORT = 5555 # change the port if necessary

import subprocess
server = subprocess.Popen('python -m http.server {}'.format(PORT).split())
print('\nSee the slides at: http://localhost:{}/Introduction.slides.html'.format(PORT))


See the slides at: http://localhost:5555/Introduction.slides.html

Stop the server with:


In [30]:
server.kill()

Introduction to the Actor Model of Computation

Walter Moreira
https://github.com/waltermoreira/actor_model

  • Thanks for the opportunity

  • TACC is the right environment, massively distributed/parallel system

  • Slides and code available, references at the end

  • Talk in two parts (intro and code)

Actor Model History

  • Carl Hewitt (1973), Gul Agha (1986)

  • Influences from early Object Oriented paradigm (Smalltalk, Alan Kay)

  • Inspired from physics (relativity and locality laws hold!)

  • The model is old (for technology), same as Lisp, Smalltalk...

  • Easy to think about, compared to abstract notions (physics oriented)

  • Recommend Agha thesis

  • Unfortunately, model hasn't succeeded (until now!)

  • ... although many systems (even big ones) can be modelled as actors

Features

  • Basis for theory and practice

  • Share Nothing, Message Passing semantics (ultimate OO language!)

  • Strictly more powerful than classic computation (Turing machines, lambda calculus)

  • Security by construction (capabilities are subsumed in actors)

  • Composable (fractal Lego pieces)

  • It is really usable by programmers, modular thinking

  • Other concurrent theories are more abstract (CSP - communicating seq. processes)

  • More powerful than regular comp. (initial CSP theories were not)

  • Capabilities could eliminate passwords

  • Full composition. Some people complain about this. Assoc. and Comm.

Definition

An actor is an entity that receives a message and, in response, can concurrently:

  • send a message to other actors it knows about

  • create a finite number of new actors

  • designate the behavior to handle the next message it receives

  • No order in operations

  • Only send to known actors (local state). No global state.

  • Single threaded, sequential processing. Only one become.

  • No processes, or queues (different as Erlang). An actor is activated by a message.

A minimal actor language contains the primitives:

  • send

  • create

  • become

Important notes

  • A message can be anything, including actors (actor addresses)

  • Messages do not include return address

  • An actor is single threaded (linear order of events it processes), but no order in events it sends

  • Messages are guaranteed to be delivered (which implies fairness)

  • Topology of the network is dynamic

  • Addresses cannot be constructed (implies security)

  • Actor can create or get addresses, but they propagate at finite speed. (more later) Implies there is no global clock

  • No order in messages implies non-determinism (but unbounded!) Turing machine is bounded (by Konig's lemma)

  • Many concepts of fairness (not starving a service), guaranteed delivery is the weakest, but enough to reason.

A bit of theory

  • Actor model has unbounded nondeterminism: can construct an actor system that

    • Always halts

    • For any positive integer $n$, it can compute a number $m\ge n$

  • Denotational semantics: Clinger (1981), operational semantics: Agha (1983, 1986)

  • Principle of Actor Induction, to reason about invariants

  • Algebra of configurations

Current Systems based on Actors

(None of these are the pure actor model)

  • Erlang, Elixir: selective receive, processes, can synthesize addresses

  • Akka (Scala)

(closer to pure actor model)

  • Orleans (Microsoft Research)
  • Also, several frameworks on many languages

  • CSP is more algebraic, but farther away from implementation. Strict requirements on order of processes.

  • Go is closer to CSP (via channels)

Other theories

  • CSP: Communicating Sequential Processes (Hoare, 1978)

  • $\pi$-calculus (Milner, 1992)

A word on actor addresses

  • Two domains: local, remote

  • In practice, use cryptographic hashes for both (e.g.: SHA-X)

  • Find nodes through standard internet protocols or Distributed Hash Tables

A word on configurations

  • A configuration is a group of actors behaving transparently as one actor

  • May contain several receptionists, and they can vary in time

  • The composition is associative, commutative, and has an identity (commutative monoid)

References

See these references at: https://github.com/waltermoreira/actor_model

  • Gul Agha. Actors: A Model of Concurrent Computation in Distributed Systems. Doctoral Dissertation. 1986.

  • Gul Agha, Ian Mason, Scott Smith, Carolyn Talcott. A Foundation for Actor Computation. Journal of Functional Programming, January 1993.

  • Carl Hewitt, Peter Bishop and Richard Steiger. A Universal Modular Actor Formalism for Artificial Intelligence. IJCAI’73.

  • Carl Hewitt. Actor Model of Computation: Scalable Robust Information Systems. Inconsistency Robustness 2011, Stanford University.

  • Dale Schumacher. It's Actors All The Way Down. Blog.

Thanks to Tristan Slominski and Dale Schumacher for introducing me to tartjs