Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Guarded entries and deadlocks in Ada [Solved]

  1. Sep 9, 2011 #1
    This is a pretty general question that I haven't found an answer to, so I'd really appreciate the help.

    Let's say we have 3 tasks - Alpha, Bravo and Charlie, all within the one and same procedure.

    Alpha takes calls from Bravo, which in turn takes calls from Charlie.

    Alpha's entry is guarded by some condition, which prevents accepting a call from Bravo.

    Meanwhile, Bravo has the following loop:

    loop
    select
    accept Call_from_Charlie;
    exit;
    or
    delay 0.0;
    Alpha.Do_stuff;
    end select;
    end loop;

    ... and all Charlie does is call Bravo.Call_from_Charlie.

    Now, my question is: will Bravo ever get stuck waiting for Alpha to accept its call, ignoring Call_from_Charlie until Alpha accepts the Do_stuff call, causing a deadlock with Charlie waiting for Bravo, which is in turn waiting for Alpha?

    In other words, when Bravo reaches the line of code reading "Alpha.Do_stuff;", and Alpha won't accept the call because the entry is guarded, what does Bravo do?

    I haven't been able to produce a deadlock this way, but I'd like to know whether it's at all possible.

    EDIT: I have now been able to produce a deadlock this way. Don't know why it didn't happen the first time, but it does now.
     
    Last edited: Sep 9, 2011
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Guarded entries and deadlocks in Ada [Solved]
  1. Ada Programming (Replies: 0)

Loading...