Академический Документы
Профессиональный Документы
Культура Документы
Joe Armstrong
HOPL-III
joe.armstrong@ericsson.com
1/45
Plan
Beginnings
What is Erlang?
Pre history
Innovations
Philosophy
Spreading the language
Future
2/45
Beginnings
1985 - “find better ways of programming telephony”
SPOTS - LOTS
SPOTS = SPC for POTS
SPC = Stored Program Control (“computer controlled”)
POTS = Plain Ordinary Telephone Service
3/45
What is Erlang?
4/45
What is Erlang?
- Concurrent (processes belong to Language – NOT OS)
- Very light-weight concurrency (lighter than threads)
- “Share nothing” process semantics
- Pure asynchronous message passing
- Core language is a simple dynamically typed FPL
- Non-pure extensions (ets) for implementing
databases.
- Mechanisms for in-service code upgrade
- Large set of libraries (OTP)
(Unix <-> C <==> OTP <-> Erlang)
5/45
Pre history
AXE – programmed in PLEX
PLEX
Programming language for exchanges)
Proprietary
blocks (processes) and signals
in-service code upgrade
Eri Pascal
6/45
Requirements
- Handling a very large number of concurrent activities
- Actions to be performed at a certain point of time or
within certain time
- Systems distributed over several computers
- Interaction with hardware
- Very large software systems
- Complex functionality such as feature interaction
- Continuous operation over several years
- Software maintenance (reconfiguration, etc.) without
stopping the system
- Stringent quality and reliability requirements
- Fault tolerance both to hardware failures and
software errors
7/45
1985 - 1998
8/45
1985 - 1989
Erlang is born
- Programming POTS/LOTS/DOTS
- A Smalltalk model of POTS
- A telephony algebra (math)
- A Prolog interpretor for the telephony algebra
- I add processes to prolog
- Prolog is too powerful (backtracking)
- Deterministic prolog with processes
- “Erlang” !!!
- ...
- Compiled to JAM code
-
9/45
Phoning Philosopher's
11/45
The Prolog interpretor (1986)
version 1.06 dated
1986-12-18
12/45
The first Erlang operations manual (1986)
13/45
Teaching Erlang
14/45
(A pre powerpoint slide - 1986)
1988 – Interpreted Erlang
15/45
Ways of working
- Light-weight committees
- Total rewrite < 1 week
- Language feature = one hacking
session
- Try it out on the users, keep
the good stuff
- Many different versions
- Clear goal – we knew what we
wanted to do but not how
- Nobody knew what we were
doing
16/45
1989 – The need for speed
ACS- Dunder
- “we like the language but it's too slow” - must be 40 times
faster
17/45
An early JAM compiler (1989)
sys_sys.erl 18 dummy
sys_parse.erl 783 erlang parser fac(0) -> 1;
sys_ari_parser.erl 147 parse arithmetic expressions fac(N) -> N * fac(N-1)
sys_build.erl 272 build function call arguments
sys_match.erl 253 match function head arguments
sys_compile.erl 708 compiler main program {info, fac, 1}
sys_lists.erl 85 list handling {try_me_else, label1}
sys_dictionary.erl 82 dictionary handler {arg, 0}
sys_utils.erl 71 utilities
sys_asm.erl 419 assembler
{getInt, 0}
sys_tokenise.erl 413 tokeniser {pushInt, 1}
sys_parser_tools.erl 96 parser utilities ret
sys_load.erl 326 loader label1:
sys_opcodes.erl 128 opcode definitions
sys_pp.erl 418 pretty printer try_me_else_fail
sys_scan.erl 252 scanner {arg, 0}
sys_boot.erl 59 bootstrap dup
sys_kernel.erl 9 kernel calls
18 files 4544 {pushInt, 1}
minus
{callLocal, fac, 1}
Like the WAM with added primitives for times
spawning processes and message passing ret
18/45
During development
19/45
1989 - Clarity
1989 (SETSS conference Bournemouth)
20/45
Shared memory
and
Fault tolerance
is
Incredibly difficult
21/45
Sharing
is the
property
that
prevents
fault tolerance
22/45
Chronology from 1989 onwards
23/45
1985 - 1998
24/45
What did we learn?
25/45
Innovations
- bit syntax
- link mechanism
- non-defensive programming
- pure message passing works
26/45
Bit Syntax
- Pattern matching over bits
unpack(<<Red:5,Green:6,Blue:5>>) ->
... -define(IP_VERSION, 4).
-define(IP_MIN_HDR_LEN, 5).
27/45
(unpack Ipv4 datagram)
Links A is linked to B
B is linked to C
28/45
Supervision trees
29/45
“let it crash”
30/45
Pure message passing concurrency works
31/45
Philosophy –
explaining what we're doing
32/45
Concurrency Oriented Programming
●
A style of programming where
concurrency is used to
structure the application
●
Large numbers of processes My first message is that
●
Complete isolation of concurrency
processes is best regarded as a program
●
No sharing of data structuring principle”
●
Location transparency
Structured concurrent programming
●
Pure message passing – Tony Hoare
Redmond, July 2001
33/45
What is COP?
Machine
Process
Message
●
Large number of processes
●
Complete isolation between
processes
●
Location transparency
●
No Sharing of data
●
Pure message passing systems
34/45
Erlang Style Concurrency
- Share nothing
- Pure message passing
- “Let it crash”
35/45
Spreading the language
1986 – CSLab (Ericsson)
1987 – Bollmora ACS/Dunder starts (First users) (results 1989)
1998 – SETS 1989 (Bournemouth) – contact with John Unger Bellcore
1990 – ISS90 – shown in public
1992 – Concurrent Programming in Erlang (Prentice Hall)
1993 – Erlang systems AB (“Uppsala master's student's”)
1998 – Erlang banned in Ericsson
Open-source Erlang
Blutail
2000 – Bluetail acquired by Alteon , subsequently Nortel
2001 – Dot-com bubble crashes
(This lays the seeds of half a dozen Erlang companies)
2002-2004 – Staying alive - “survival of the fittest”
2004-2007 – Resurgence
2006 – SMP Erlang
2007 - “Programming Erlang” (The Pragmatic Programmers)
“Multicore” erlang works! (New products in Ericsson)
36/45
ISS 90
37/45
User Conferences
User conferences held
every year since 1994
(except 1996)
38/45
Does
it
work?
39/45
Commercial Successes
40/45
The future
41/45
Erlang is great on multicores
Q: Why?
42/45
Lessons Learnt
- Message passing concurrency works
The extra overhead of copying is unimportant
- Isolation is the key property of the language
- Processes belong to languages NOT OS's
- Pure is fast (enables concurrency)
- “share nothing” is fast enough
- Don't compromise beauty for efficiency
43/45
Acknowledgements
To Ericsson AB for their support
44/45
Questions