CEG 7370 Distributed Computing | Slides

Actors, Akka and Scala: Overview

Table of Contents

1 Overview of Lectures

  1. May be 3 to 4 lectures (75 minutes) total.
  2. 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].
  3. Describe the Actors Model, comparable in depth to our treatment of SMP, AMP, Shared-Vars, Semaphores.
  4. Describe Akka, an implementation of Actors. Just enough so you can re-do all the classics such as Readers/Writers, Dining Philosophers.
  5. Show-and-Tell ./typesafe-activator.html
  6. WSU CEG 7370 P3 details depend on the above.

2 What is Scala?

  1. Can be thought of as a modernized Java.
  2. Combines OOP and Functional Programming.
  3. Uses Type Inference heavily.
  4. Compiles to JVM .class files.
  5. Scala http://www.scala-lang.org/ is open source.
  6. CEG 7370 on Scala

3 Actors Model

  1. A model of distributed computation.
  2. Uses AMP only.
  3. No semaphores. No SMP.
  4. Can we build these in Actors?
  5. CEG 7370 on Actors

4 What is Akka?

  1. Akka is an implementation of the Actor Model.
  2. It makes practical concessions to the pure actor model.
  3. Implemented as a library in Scala (and hence JVM). Akka library can be used in Java as well.
  4. "Akka is a toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications on the JVM" http://www.akka.io
  5. Akka is open source.
  6. CEG 7370 on Akka

5 Dining Philosophers on Akka

  1. 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.
  2. DiningHakkersOnBecome.scala minor mods by Mateti
  3. DiningHakkersOnFsm.scala minor mods by Mateti
  4. The numbers at left are the count of lines.
    106 DiningHakkersOnBecome.scala
    141 DiningHakkersOnFsm.scala
    
  5. My versions can be compiled and run without using Activator: % scalac DiningHakkersOnBecome.scala; % scala DiningHakkersOnBecome
  6. dining-philosophers-akka-fsm fairly detailed explanation of the Akka FSM based code.
  7. https://www.typesafe.com/activator/template/akka-sample-fsm-scala

Copyright © 2014 pmateti@wright.eduwww.wright.edu/~pmateti