Introduction to Erlang

11,161 views
10,975 views

Published on

A excerpt of my talk about Erlang and Powerset's use of it at Microsoft on 12/4/08.

Please feel free to distribute, but do not modify.

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,161
On SlideShare
0
From Embeds
0
Number of Embeds
1,009
Actions
Shares
0
Downloads
145
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Introduction to Erlang

  1. Erlang Essentials Core Language Features of Interest Excerpt From 12/4/08 Microsoft Presentation Slides by Dave Fayram dfayram@microsoft.com © 2008 Powerset
  2. Erlang Basics • A Functional Language • Based around pattern matching, a total lack of shared state, and a flexible message passing system. • Lightweight Processes are just tail- recursive functions executing in parallel. © 2008 Powerset
  3. Erlang Example © 2008 Powerset
  4. Pattern Matching • Erlang has no assignment. • Every “=” statement forms a relationship. • Type descriptions are also valid for pattern matching. © 2008 Powerset
  5. Pattern Matching © 2008 Powerset
  6. Lightweight Processes • Any function (named or anonymous) can become a process. • A process is simply a function executing in parallel. • Process semantics mirror function semantics. © 2008 Powerset
  7. Lightweight Processes • Extremely Efficient! • Modern systems can accommodate literally millions of Erlang processes. • Erlang LWP can be run in parallel on multiple CPUs. • Programs heavily reliant on processes tend to get free performance boosts. © 2008 Powerset
  8. Lightweight Processes © 2008 Powerset
  9. Lightweight Processes © 2008 Powerset
  10. Asynchronous Messages • The “!” operator sends messages. • Asynchronous, no guarantee of delivery. • The “receive” statement matches messages. • One call to receive, one message removed from the process message queue. • Uses Pattern Matching to select messages © 2008 Powerset
  11. [target] ! [message] © 2008 Powerset
  12. Asynchronous Messages © 2008 Powerset
  13. Asynchronous Messages © 2008 Powerset
  14. Asynchronous Messages © 2008 Powerset
  15. Asynchronous Messages • Erlang does not distinguish between “local” processes and “remote” processes. • This is the core of Erlang’s distributed programming. • Semantics are identical (already, no strong guarantees of message delivery). © 2008 Powerset
  16. Asynchronous Messages © 2008 Powerset
  17. Asynchronous Messages © 2008 Powerset

×