Erlang
|
Now we have Joe Armstrong - an invited speaker to talk to us about Erlang. I've always been curious about Erlang - Patrick Logan has said good things about it, for instance. He's worked in Smaltalk, and likes it. His work has been in telephony, and Smalltalk was a bit slow for their purposes (this is way back). Ordered a Tektronix Smalltalk machine (that's how far back :) ) - but there was a two month wait for it. |
In the interim, he fell into Prolog by accident. By the time the Smalltalk machine arrived, he was more interested in working with Prolog. He gave the Smalltalk machine away, and Objectory came out of that donation. In further experimentation, he added concurrency to Prolog - and this is where Erlang was born - Joe is the inventor of Erlang. He's curently a senior system architect at Ericsson AB.
One thing that Erlang is very good at is creating large numbers of processes. In Java, for instance, processes map down to the OS (threads) - and that takes away predictable behavior. So what you want is:
- create large numbers of processes
- work the same on different OS's
- are garbage collected
- are location transparent
- cannot damage other processes
- are defined in the language
- creating and destroying processes should be lightweight
Niall Dalton: Erlang is Smalltalk the way Alan Kay wanted it to be - this got a nice laugh from the audience :)
Assertion: To make a fault tolerant system, you need at least two computers. That means that you are doing distributed programming. To simplify the problems, have:
- No sharing
- pure message passing
- no locks
Sharing gets in the way of fault tolerance. This gives us Concurrency Oriented Programming:
- A style where concurrency is used to structure the programming
- large number of processes
- complete isolation of processes
- no sharing of data
- location transparency
- pure message passing
So the design rules:
- Identify the concurrent operations in the problem
- identify the message channels
- write down the set of messages seen on each channel
- write down the protocols
- write down the code
Try to make the design isomorphic to the problem - i.e., a 1:1 correspondence between process/message structure in the model and the problem.
In 1998, Erlang got banned at Ericsson, due to a "we must use standard languages" wave (sounds familiar). The upshot was, Erlang got open sourced, and the Erlang folks formed Bluetail. Bluetail was later acquired.
The basic concept here: systems should be black boxes that can communicate - failures in one black box should not crash another black box. This leads to making all communication asynchronous. The problem domain:
- Highly concurrent - hundreds of thousands of parallel activities
- Real time
- Distributed
- High Availability - down times of minutes/year - never down
- Complex Software - millions of lines of code
- Continuous Operation - years
- Continuous Evolution
- In service upgrade
So to get this:
| Concurrency | processes |
| Error encapsulation | isolation |
| fault detection | what failed |
| Fault identification | why it failed |
| Live code upgrade | evolving systems (multiple versions at same time) |
| Stable storage | crash recovery |
Isolation is key here: It's why hardware components are easier to build. Erlang is designed to operate concurrently via message passing, with isolation. So:
Processes have share nothing semantics and data must be copied. Message passing is the only way to exchange data. Message passing is asynchronous. My program should not be able to crash your program.
Programming for Errors: If you can't do what you want to do, try and do something simpler :) Using these techniques, they've built a 9 nine's reliable GPRS system in Europe.


Comments
opinions? audience questions?
[Isaac Gouy] September 7, 2006 13:58:08.540
James I've always been curious about Erlang
So what did you and others in the audience think of it? How does it compare to Cincom ST?
Re: Erlang
[ James Robertson] September 7, 2006 14:51:48.561
Comment by James Robertson
He got a good reception here. Erlang sounds like the tool you want to use if you are solving the kinds of problems that come up in telecom systems. Smalltalk could be built for that, but it's not that way now. Ultimately, I'd say it boils down to "pick the right tool for the job".
solving the kinds of problems
[Isaac Gouy] September 7, 2006 15:12:21.003
So Erlang should be useful outside of telecom where high reliability is a key requirement, where the heart of the application is switching ... Erlang in Banking and Financial Switching (ppt)