Actors, Akka and Scala: Overview
Table of Contents
1 Overview of Lectures
- May be 3 to 4 lectures (75 minutes) total.
- Describe Scala minimally. Just enough to do Akka. Pretty much ignore its (i) functional programming features, (ii) syntactic conveniences and (iii) type inference [not wholly].
- Describe the Actors Model, comparable in depth to our treatment of SMP, AMP, Shared-Vars, Semaphores.
- Describe Akka, an implementation of Actors. Just enough so you can re-do all the classics such as Readers/Writers, Dining Philosophers.
- Show-and-Tell ./typesafe-activator.html
- WSU CEG 7370 P3 details depend on the above.
2 What is Scala?
- Can be thought of as a modernized Java.
- Combines OOP and Functional Programming.
- Uses Type Inference heavily.
- Compiles to JVM .class files.
- Scala http://www.scala-lang.org/ is open source.
- CEG 7370 on Scala
3 Actors Model
- A model of distributed computation.
- Uses AMP only.
- No semaphores. No SMP.
- Can we build these in Actors?
- CEG 7370 on Actors
4 What is Akka?
- Akka is an implementation of the Actor Model.
- It makes practical concessions to the pure actor model.
- Implemented as a library in Scala (and hence JVM). Akka library can be used in Java as well.
- "Akka is a toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications on the JVM" http://www.akka.io
- Akka is open source.
- CEG 7370 on Akka
5 Dining Philosophers on Akka
- This Spring 2014, the CEG 7370 Project P3 is mostly about learning Scala + Akka to some extent. Start with the source code examples below. These two files are "implementing" the famous Dining Philosophers problem. Not the solution.
- DiningHakkersOnBecome.scala minor mods by Mateti
- DiningHakkersOnFsm.scala minor mods by Mateti
- The numbers at left are the count of lines.
106 DiningHakkersOnBecome.scala 141 DiningHakkersOnFsm.scala
- My versions can be compiled and run without using Activator:
% scalac DiningHakkersOnBecome.scala; % scala DiningHakkersOnBecome
- dining-philosophers-akka-fsm fairly detailed explanation of the Akka FSM based code.
- https://www.typesafe.com/activator/template/akka-sample-fsm-scala