Getting locks and sharing: was RE: Getting concurrency

Thomas Lindgren <>
Tue Jun 14 20:13:14 CEST 2005



--- "Joe Armstrong (AL/EAB)"
<> wrote:

> This thread has a crazy title "Getting concurrency"
> - this implies people just don't get it
>
> The title should be "Getting locks and sharing" -
> now that's the stuff I just don't get
> try and make locks and shared data work in the
> presence of failure - now that *is*
> a nightmare.

Just getting all the details right in the ordinary
execution scenario isn't trivial, either in theory or
practice. That's what I mean by "getting it": reliably
producing good-quality code concerning "it".

Failures add extra spice to this, of course.

> Concurrency IS - that's how the world is - things
> happen in parallel.
...
> You can program perfectly well without locks and
> sharing just by using message passing to both
> communicate and synchronise - the code is simple and
> easy to understand.
> 
> Currency isn't difficult to "get" - but locks and
> sharing are

However, as programmers we are in the business of
orchestrating these happenings in some detail, not
just experiencing them.

Even if you are programming with failure-free message
passing, you still have to consider race conditions,
or (more generally) event interleavings in your
system. And you will in principle have to consider all
possible such interleavings, or worse. (Worse when
your notion of time does not even include
"interleaving".) 

Some of these interleavings may manifest failures of
some sort (e.g., trying to send to a process or
service which hasn't started yet, or which has
terminated). Others can result in deadlocks or crashes
(e.g., receiving messages in an order the recipient
did not plan for). And so on.

While I would definitely say message passing makes
this reasoning easier, it can still be a formidable
task.

And don't forget other aspects such as efficiency,
scalability, reusability, maintainability, ... E.g.,
"Does this highly optimized design I inherited
actually work? What if I also have to implement these
new requirements?" etc.

Experience, "getting it", individually and
collectively, will help in overcoming this ... but at
this time, I don't think we're there.

Best,
Thomas



		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



More information about the erlang-questions mailing list