SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Actor based programming
       In Erlang, Scala and F#




                                                         Page 1
                                 Actor model baksia , 29.09.2012
Agenda


• The reason
• The Actor Model
• Erlang
• Scala
• F#
• OTP and AKKA




                                            Page 2
                    Actor model baksia , 29.09.2012
The base of the problem




                                                  Page 3
                          Actor model baksia , 29.09.2012
Another reason




                                         Page 4
                 Actor model baksia , 29.09.2012
Concurrency and shared memory model




                                                       Page 5
                               Actor model baksia , 29.09.2012
Shared memory model



              Shared
              memory

 Process                Process
 thread                 thread


              Process
              thread




                                                      Page 6
                              Actor model baksia , 29.09.2012
Problems with shared memory


• Race conditions
• Block contention
• Deadlock




                                                         Page 7
                                 Actor model baksia , 29.09.2012
What is the Actor Model


• Light weight processes/threads communicating through
  messaging
   • Messages are buffered in a “mailbox”

• No shared state
• Isolated from other processes
• Normally event systems are inversion of control
   • Adding a listener to an object
   • Hard to maintain in large systems

• Humans do not share memory, we communicate through
  messages


                                                                            Page 8
                                                    Actor model baksia , 29.09.2012
Pattern Matching




                                           Page 9
                   Actor model baksia , 29.09.2012
Erlang


• The world is concurrent
• Things in the world don't share data
• Things communicate with messages
• Things fail
       - Joe Armstrong




                                                                Page 10
                                         Actor model baksia , 29.09.2012
Crash course in Erlang
Variables are immutable




                                                   Page 11
                            Actor model baksia , 29.09.2012
Atoms and tuples


• An atom is a global constant starting with lower case
• A tuple is an ordered set of elements
• Your Java or C# class would be a tuple with an atom
  identifier




                                                                            Page 12
                                                     Actor model baksia , 29.09.2012
Spawn and process ID
• Spawn “spawns” a new Erlang process (light weight)
• Spawn returns a PID (Process identifier)
• Receive waits for a message




                                                                         Page 13
                                                  Actor model baksia , 29.09.2012
Actors in Erlang




                                          Page 14
                   Actor model baksia , 29.09.2012
Crash course in Scala


• Object functional programming language
• Everything in Scala is an object, even functions
• Running on JVM and interoperable with Java language
   • Also runs on Dalvik VM for Android (Java bytecode)

• Concurrent oriented programming language
• Actor model programming style from Erlang
• Interactive shell
• No attachment to Oracle




                                                                                 Page 15
                                                          Actor model baksia , 29.09.2012
Scalatest TestStack




                                             Page 16
                      Actor model baksia , 29.09.2012
Scala Actors




                                      Page 17
               Actor model baksia , 29.09.2012
React or receive


• React is the “normal” actor, lightweight process
• Receive spins out a new Java thread
• In the paper *
    • 5000 threads
    • 1 200 000 actors

• React uses partial functions to send the process to the
  heap
• Receive runs on the stack and is heavyweight JVM
  threads (like Java)
*Actors That Unify Threads and Events P. Haller, M. Odersky



                                                                                     Page 18
                                                              Actor model baksia , 29.09.2012
Scala Actor on tuples




                                               Page 19
                        Actor model baksia , 29.09.2012
Scala Actor with case classes




                                                       Page 20
                                Actor model baksia , 29.09.2012
Crash course in F#


• F# is a object functional programming language for the
  .Net Framework
• Derived from ML and is largely compatible with OCaml
• Interactive shell, script and compiled language
• Runs on mono for Posix based systems




                                                                           Page 21
                                                    Actor model baksia , 29.09.2012
Code example F#




                                         Page 22
                  Actor model baksia , 29.09.2012
F# Actor MailboxProcessor




                                                   Page 23
                            Actor model baksia , 29.09.2012
Let it crash (supervision)


• Erlang/OTP
• Scala Akka
• Erlang designed for five nines 99.999 uptime, record is
  nine nines 99.999999999
• That is 31ms downtime a year




                                                                            Page 24
                                                     Actor model baksia , 29.09.2012
Supervisors in Erlang/OTP and AKKA



   Supervisor

                            Process




                  Process
     Process




                                                             Page 25
                                      Actor model baksia , 29.09.2012
Supervising supervisors

  Root
Supervisor




                                 Supervisor
Supervisor
                                                         Process
                       Process



                                 Process      Process
Process      Process


                                                                         Page 26
                                                  Actor model baksia , 29.09.2012
Page 27
Actor model baksia , 29.09.2012

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Kürzlich hochgeladen (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Actor three languages

  • 1. Actor based programming In Erlang, Scala and F# Page 1 Actor model baksia , 29.09.2012
  • 2. Agenda • The reason • The Actor Model • Erlang • Scala • F# • OTP and AKKA Page 2 Actor model baksia , 29.09.2012
  • 3. The base of the problem Page 3 Actor model baksia , 29.09.2012
  • 4. Another reason Page 4 Actor model baksia , 29.09.2012
  • 5. Concurrency and shared memory model Page 5 Actor model baksia , 29.09.2012
  • 6. Shared memory model Shared memory Process Process thread thread Process thread Page 6 Actor model baksia , 29.09.2012
  • 7. Problems with shared memory • Race conditions • Block contention • Deadlock Page 7 Actor model baksia , 29.09.2012
  • 8. What is the Actor Model • Light weight processes/threads communicating through messaging • Messages are buffered in a “mailbox” • No shared state • Isolated from other processes • Normally event systems are inversion of control • Adding a listener to an object • Hard to maintain in large systems • Humans do not share memory, we communicate through messages Page 8 Actor model baksia , 29.09.2012
  • 9. Pattern Matching Page 9 Actor model baksia , 29.09.2012
  • 10. Erlang • The world is concurrent • Things in the world don't share data • Things communicate with messages • Things fail - Joe Armstrong Page 10 Actor model baksia , 29.09.2012
  • 11. Crash course in Erlang Variables are immutable Page 11 Actor model baksia , 29.09.2012
  • 12. Atoms and tuples • An atom is a global constant starting with lower case • A tuple is an ordered set of elements • Your Java or C# class would be a tuple with an atom identifier Page 12 Actor model baksia , 29.09.2012
  • 13. Spawn and process ID • Spawn “spawns” a new Erlang process (light weight) • Spawn returns a PID (Process identifier) • Receive waits for a message Page 13 Actor model baksia , 29.09.2012
  • 14. Actors in Erlang Page 14 Actor model baksia , 29.09.2012
  • 15. Crash course in Scala • Object functional programming language • Everything in Scala is an object, even functions • Running on JVM and interoperable with Java language • Also runs on Dalvik VM for Android (Java bytecode) • Concurrent oriented programming language • Actor model programming style from Erlang • Interactive shell • No attachment to Oracle Page 15 Actor model baksia , 29.09.2012
  • 16. Scalatest TestStack Page 16 Actor model baksia , 29.09.2012
  • 17. Scala Actors Page 17 Actor model baksia , 29.09.2012
  • 18. React or receive • React is the “normal” actor, lightweight process • Receive spins out a new Java thread • In the paper * • 5000 threads • 1 200 000 actors • React uses partial functions to send the process to the heap • Receive runs on the stack and is heavyweight JVM threads (like Java) *Actors That Unify Threads and Events P. Haller, M. Odersky Page 18 Actor model baksia , 29.09.2012
  • 19. Scala Actor on tuples Page 19 Actor model baksia , 29.09.2012
  • 20. Scala Actor with case classes Page 20 Actor model baksia , 29.09.2012
  • 21. Crash course in F# • F# is a object functional programming language for the .Net Framework • Derived from ML and is largely compatible with OCaml • Interactive shell, script and compiled language • Runs on mono for Posix based systems Page 21 Actor model baksia , 29.09.2012
  • 22. Code example F# Page 22 Actor model baksia , 29.09.2012
  • 23. F# Actor MailboxProcessor Page 23 Actor model baksia , 29.09.2012
  • 24. Let it crash (supervision) • Erlang/OTP • Scala Akka • Erlang designed for five nines 99.999 uptime, record is nine nines 99.999999999 • That is 31ms downtime a year Page 24 Actor model baksia , 29.09.2012
  • 25. Supervisors in Erlang/OTP and AKKA Supervisor Process Process Process Page 25 Actor model baksia , 29.09.2012
  • 26. Supervising supervisors Root Supervisor Supervisor Supervisor Process Process Process Process Process Process Page 26 Actor model baksia , 29.09.2012
  • 27. Page 27 Actor model baksia , 29.09.2012