Message Passing, Concurrency, and Parallelism in Erlang
Download
Report
Transcript Message Passing, Concurrency, and Parallelism in Erlang
Message Passing, Concurrency,
And Parallelism
with Erlang
Presented By: Craig R. Kuehn
Department of Computer Science and
Software Engineering
University of Wisconsin-Platteville
[email protected]
History
R&D @ Ellemtel CS Lab
1985 – Tried 20 Different Languages
1987 – First Experiments with Erlang
1991 – First Project in Erlang
1993 – BOS
1996 – OTP!
1999 – OPEN SOURCE!!!
2003 – Workshop Joins ACM SIGPLAN ICPF
2006 – SMP Capable
Ready!
Most Important Rule:
Programming Is Fun!!
AI class?
Functional Programming?
Concurrency-Oriented
Programming?
Set!
GO!!!
The Basics…
We Have to Start Somewhere
Variables
Start With a Capital Letter
Single Assignment – Not Like C++ or
Java (I told you to forget about them)
“=“ -> Lhs = Rhs
Bound v.s. Unbound
“_” the anonymous variable
Why Single Assignment?
Scope
…The Basics Continued…
Data Types
Integers
Floats
Atoms
Tuples
Records
Lists
Strings
Binaries
…The Basics Continued Still…
Modules
Basic Unit
moduleName.erl
Compiled
moduleName.beam
Module
Import
Export
…The Basics Continued Still
More…
Functions
Clauses
Head -> Body
“Tried” In Order
Arity
fun Anonymous Function
Higher-Order Functions
List Comprehensions
BIFs
…The Basics Continued And
Still More…
Conditions/Controls
Not really needed
Guards (semicolon and comma delimited)
Case
If
Exceptions
Intermission From The Heavy
Stuff
A Tidbit About Erlang
Targets or Goals In Mind During
The Design
Fault Tolerant
Continuous
Concurrent
Distributed, Heterogeneous
Highly Reliable, “Soft”Real-time
Scalable
Tail Recursive
Process-Oriented
The Advanced Part…
Marching Onward
Process Stuff
Process Dictionary
Pure Message Passing Language
Detriment To Your Health
Bad Horror Movies
Relax
…The Advanced Part
Continued…
Message Passing, Concurrency,
and Parallelism Tools
Spawn()
“!” The Send Operator
Receive…end (Blocking and Non-Blocking)
…The Advanced Part
Continued Still…
The Intricate Parts of Receive
Timer
First Message
Not A Match
No More Messages
It Is A Match!!!
Timer Elapses
…The Advanced Part
Continued Still More…
Message Passing, Concurrency,
and Parallelism Specs
Publishing a Process Identifier
Spawning with MFA
“Hot Swapping”
…The Advanced Part
Continued And Still More…
Message Passing, Concurrency,
and Parallelism Errors
Exit Signals
Linking
Monitors
Gosh, Finally!
The Future:
Concurrency-Oriented Programming
Erlang
UW-Platteville CS Department
So You Think You Have A
Question, Do You?
Well Do You?