CS 563 Concurrent Programming
Lecture 3: Actor Model of Concurrency
Building a Reading List
Copyright By PowCoder代写 加微信 powcoder
Every ~2 weeks, each student searches for a good research paper in topics that are relevant to the class
Submit your paper list on Blackboard, along with the source where you found it (two due dates: mid Feb and mid March)
Potential sources: IEEE online library, ACM online library, WSU library website, Google Scholar
Later research paper presentations will be based on this reading list (I can help you refine your list)
Moore’s Law
The number of transistors on a chip will double approximately every 18 months
. Moore, 1965
Cost vs. time sketch from Moore’s 1964 notebook
The End of Moore’s Law?
source: Intel
source: FiCloud 2017 paper from my group
1985 1990 1995 2000 2005 2010 2015
AMD DEC Hitachi IBM YMeoatrorola SGI Cyrix NexGen Zilog HP Intel MIPS Sun HAL Ross Centaur
Why$You$Don’t$Have$10GHz$Today$
Hardware crossed a boundary in the early 2000s: chips got big enough, cycle speed got fast enough
a signal can no longer reach the whole chip in a clock
problems with heat dissipation
Clock frequency (MHz)
The End of Moore’s Law?
Amdahl’s Law
“Amdahl’s Law in the Multicore Era”, Computer, 41(7), 33-38, 2008
Shared Variable Concurrency
Shared mutable state/variable
Locking mechanism
Threads concurrently execute code sections
Contains resources that must be shared Synchronized in order to guarantee
correct ordering visibility
data consistency
Shared Variable Concurrency
Why threads are evil
What is this?
Why does it happen?
Does it always happen?
“Non-trivial multi-threaded programs are incomprehensible to human …” . Lee, The Problem with Threads
Message Passing Concurrency
1973, paper by
1986, “Actors: A Model of Concurrent Computation in Distributed Systems”, by
Avoid the problems caused by threading and locking
Implemented in Erlang, Scala
Unique Name
Method State
Actors [Agha, 1986] make writing concurrent programs easier
Key Principals
Actors instead of objects
No shared state between actors Asynchronous message-passing Mailboxes to buffer incoming messages
Actors never share state and thus never need to compete for locks for access to shared data
React to received messages by executing a behavior function
Can only change the state of the actor itself
Can send messages to other actors
Actors exchange data by sending immutable messages Messages are sent asynchronously
Actors do not block waiting for responses to their messages
Messages buffered in an actor’s mailbox
A mailbox is a queue with multiple producers and a single consumer Also known as a channel
A pure functional dynamically typed language invented in 1986 at Ericsson
Designed for concurrency, distribution and scalability Actors are part of the language
Actors on the JVM
JVM actors implementations
Actor’s Guild Akka ActorFoundry ActorArchitecture Actorom Functional Java Kilim
Actors in the Real World
Erlang actors in the real world
Ericsson AXD 301 switch
millions of calls per second, 99.99% uptime Facebook Messenger
70 million concurrent users Twitter
WhatsApp Apache CouchDB
distributed, fault-tolerant document-oriented database
Actor Benefits
Easier to reason about
Higher abstraction level
Easier to avoid
Race conditions Deadlocks Starvation
Live locks
Distributed computing
Problem with Actors
It is not always trivial to break problem into small problems
Actors don’t work well when
Shared state is needed, e.g., bank account Need to achieve global consensus Synchronous behavior is required
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com