comp.lang.ada
 help / color / mirror / Atom feed
* D.10
@ 1999-04-12  0:00 Matthew Heaney
  1999-04-12  0:00 ` D.10 Steve Quinlan
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Matthew Heaney @ 1999-04-12  0:00 UTC (permalink / raw)


Paragraph D.10 (7) states that

"The operations Set_True and Set_False are atomic with respect to each
other and with respect to Suspend_Until_True..."


Q: Is Suspend_Until_True atomic with respect to Suspend_Until_True?

In 12.3.1 of Burns and Wellings, they state that a semaphore can be used
to program mutual exclusion between two tasks, like this:


  Sema : Suspension_Object;

  task T;

  T1, T2 : T;


  task body T is
  begin

     Set_True (Sema);

    ...

     Suspend_Until_True (Sema);

     <critical region>

     Set_True (Sema);

     ...

  end T;

     

The suspension object is true.  Now suppose the two tasks try to call
Suspend_Until_True at the same time.  Is this an atomic operation?

The assumption by Burns and Wellings seems to be that, one of the tasks
will get the suspension object first, find that it's already true, wake
up (or just stay awake), and set the flag back to false as a side-effect
of the Suspend_Until_True call.

The other task, who got in a little later, finds the suspension object
is false, and goes to sleep, until the first task finishes its critical
region, and sets the suspension object back to true.

Is this a legitimate scenario?  The RM states that PE gets raised if one
task calls Suspend_Until_True and another task is already waiting on the
same object.  But what does "already waiting on the suspension object"
mean?

Does it mean that the task has started calling Suspend_Until_True, and
isn't finished yet when the other task calls Suspend_Until_True?

Does the statement "waiting on the suspension object" include the time
when one object calls Suspend_Until_True, and the suspension object is
already true?

Or does it only refer to the time when a task calls Suspend_Until_True,
and goes to sleep because the suspension object is false?

Can calls to Suspend_Until_True interleave?









^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~1999-04-14  0:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-12  0:00 D.10 Matthew Heaney
1999-04-12  0:00 ` D.10 Steve Quinlan
1999-04-12  0:00 ` D.10 James S. Rogers
1999-04-13  0:00   ` D.10 Matthew Heaney
1999-04-13  0:00     ` D.10 Robert Dewar
1999-04-13  0:00       ` D.10 Robert Dewar
1999-04-13  0:00         ` D.10 Matthew Heaney
1999-04-13  0:00           ` D.10 Robert A Duff
1999-04-13  0:00       ` D.10 Matthew Heaney
1999-04-13  0:00 ` D.10 Robert Dewar
1999-04-13  0:00   ` D.10 Matthew Heaney
1999-04-13  0:00     ` D.10 Tucker Taft
1999-04-14  0:00       ` D.10 Robert Dewar
1999-04-13  0:00   ` D.10 Robert A Duff
1999-04-13  0:00     ` D.10 Robert Dewar
1999-04-13  0:00     ` D.10 Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox