Concurrency problem

Luke Gorrie luke@REDACTED
Sat Aug 7 21:50:48 CEST 1999

Klacke <klacke@REDACTED> writes:

> > I'm wondering if someone can help me with a pattern for avoiding a
> > deadlock.  Fundamentally, my problem is this:
> > 
> > I have two gen_server processes, A and B.  A wants to make a call on
> > B for the sake of the side-effects.  These side-effects involve making 
> > calls to A.
> > 
> This is a classic situation, I've encoutered the
> same problem over and over again. Mnesia is for example
> full with code that really would like to make a simple 
> gen_server:call to the remote side but can't do it since the
> other side would then do the same.
> You need to do some sort of async solution here.
> 1. Send request.  (gen_server:cast)
> 2. Mark request as outstanding, (change server state)
> 3. When reply comes handle it as usual.
> A bit irritating since this is such a common situation.

Thanks for the advice (and Tobbe and Pekka too).  I've had a quick
look at these parts of the Mnesia source and it's obvious there's
something for me to learn there.

I'd also really like to learn some more general rules for this sort of 
thing.  It seems that there should be useful design patterns for
structuring the concurrency safely.  Could anyone point me at some
documentation for this?  Infact, I'd like to read any documentation
that's related to erlang and can't be easily found on the website.

Something that particularly caught my eye was an abstract for a talk
Joe Armstrong gave that I found on the web, titled "Higher order
processes in Erlang".  Is there somewhere I could grab a paper
covering this material or some like it?


More information about the erlang-questions mailing list