[erlang-questions] Question regarding problems in Joe's book
Toby DiPasquale
codeslinger@REDACTED
Sat Jul 28 08:07:12 CEST 2007
On 7/27/07, Mike Berrow <mberrow1@REDACTED> wrote:
> > ..... but I wonder if anyone knows if there are answers posted
> > for the problems at the end of section 8? I've been struggling with
> > working out these problems and am looking to learn from an example.
>
> I wondered the same thing. The first problem seems simple, but I am not
> sure how to prove that it works when "two parallel processes simultaneously evaluate start/2"
I believe the answer Joe was looking for was to have a separate
process that the first n processes send messages to in order to enact
start(AnAtom, Fun). This guarantees that whichever is first gets the
success message and those coming afterwards receive the failure
message in response. This relies on Erlang's message passing
concurrency to provide a sequencing of events in a parallel
environment, rather than using shared state.
In essence, I think its a clever question to make sure you were paying
the proper attention to the preceding chapter's material ;-) Joe can,
of course, embellish or correct me if I'm wrong. Joe?
--
Toby DiPasquale
More information about the erlang-questions
mailing list