caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Ulf Wiger (TN/EAB)" <ulf.wiger@ericsson.com>
To: Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: Martin Berger <M.Berger@doc.ic.ac.uk>, caml-list@inria.fr
Subject: Re: [Caml-list] Re: Where's my non-classical shared memory	concurrency technology?
Date: Tue, 20 May 2008 09:40:09 +0200	[thread overview]
Message-ID: <48328059.2070007@ericsson.com> (raw)
In-Reply-To: <1211206144.11053.15.camel@flake.lan.gerd-stolpmann.de>

Gerd Stolpmann skrev:
> 
> This is simply nonsense. Different concurrency techniques
 > have different problems.

True.

 > For example, in event
 > handling-based concurrency you do not need locks, hence
 > you cannot run into deadlocks.

Yes you can. We've even had to write design rules to this
effect to educate our commercial Erlang programmers.

There seems to be a common belief that switching from
synchronous to asynchronous communication will eliminate
the risk for deadlock, but just like Jon noted, if two
threads/processes wait for events from the other
processes, they may deadlock*. Using asynchronous
programming just makes the deadlock much more difficult
to detect, than if the processes communicate synchronously.

* In the sense that neither can continue. Deadlock doesn't
require the presence of locks at all.

Going back to Jon's observation that you cannot exploit
multicore with event-based programming, I'm inclined to
agree, even though I think that message-passing concurrency
is quite suitable for making use of multiple cores (albeit
addressing a wholly different problem from data parallelism).

The problem with event-based programming is that it doesn't
scale complexity-wise, and just as when programming with
mutexes, introducing true parallelism just makes it worse.
While there may be some simple applications which actually
can scale up this way, doing so with more "interesting"
concurrency patterns is courting disaster.

I could list some juicy examples of important commercial
products that are limited to a single core for this very
reason, but alas I'm not permitted to. I have to ask you
to take my word for it.

When scaling up message-passing (or event-based) concurrency,
you have to do one of two things:

1) ensure that your code is stable in the face of timing
    variations and message reordering
2) calculate the entire event/state matrix

For hard real-time, you must do (2) anyway. For soft real-time,
you don't have to, since a missed deadline can be viewed as
a temporary glitch rather than a system error. And (2) suffers
from the same problems as model checking - it doesn't scale
well.

For a phone system (soft real-time), if you pick up the phone
and don't get dial tone, you replace the handset, then pick
it up again - normally, it will work then. Everyone's experienced
this, and it doesn't bother us unless it happens often.
Similarly, we can accept if it occasionally takes a few seconds
longer than usual.

The same behavior would be extremely unnerving - possibly fatal -
if the breaks on your car (hard real-time) started exhibiting it.

BR,
Ulf W


  parent reply	other threads:[~2008-05-20 10:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18  8:39 Berke Durak
2008-05-18 16:35 ` Jon Harrop
2008-05-19 11:45   ` [Caml-list] " Martin Berger
2008-05-19 12:24     ` Berke Durak
2008-05-19 21:47       ` Jon Harrop
2008-05-19 22:24         ` Berke Durak
2008-05-19 22:37           ` Raoul Duke
2008-05-20  0:04             ` Pierre-Evariste Dagand
2008-05-20 21:27           ` David Teller
2008-05-21  7:52             ` Martin Berger
2008-05-21  8:06       ` Martin Berger
2008-05-19 14:09     ` Gerd Stolpmann
2008-05-19 16:30       ` Richard Jones
2008-05-19 18:26       ` Jon Harrop
2008-05-20  7:40       ` Ulf Wiger (TN/EAB) [this message]
2008-05-21  8:18         ` Martin Berger
2008-05-21  8:06       ` Martin Berger
2008-05-21 13:50         ` Gerd Stolpmann
2008-05-26 15:29         ` Damien Doligez
2008-05-26 16:08           ` Jon Harrop
2008-05-27  9:34           ` Martin Berger
2008-05-28 11:18             ` Damien Doligez
2008-05-28 12:16               ` Jon Harrop
2008-05-28 17:41               ` Martin Berger
2008-05-29 12:02               ` Frédéric Gava

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48328059.2070007@ericsson.com \
    --to=ulf.wiger@ericsson.com \
    --cc=M.Berger@doc.ic.ac.uk \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).