Re: JavaMemoryModel: PC language alert: catatonia action

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Sun May 16 2004 - 17:47:00 EDT


> At 06:14 PM 5/15/2004, Jeremy Manson wrote:
> > > I do think that both "catatonia" and "reclusive" sound rather unpleasant.
> > >
> > > I may be missing something, but isn't the term "silent action" or "tau
> > > action" commonly used for this? See e.g. the literature on the pi-calculus.
> >
> >I believe that "silent actions" and "tau actions", like SKIP in CSP, don't
> >do anything. A catatonia action requires that the thread perform nothing
> >but catatonia actions thereafter.
> >
> >My own thoughts are along the lines of "sleep", or "suspend". I think
> >"sisyphean action" has a nice ring to it, but people don't like semantics
> >to have a nice ring to them.
>
> In general it's undecidable whether a thread will ever issue any more (non
> catatonic) actions.
> So I wonder what would depend on it? Is this another attempt to say
> something about fairness?

More or less. We didn't want to provide any guarantees for scheduling.
We did, however, want to provide a guarantee about actions that have
a visible effect to the "rest of the world" (which we call external
actions).

So if you had something like this (with done as a volatile variable):

T1:
while (!done);
print "done";

T2:
done = true;

We wanted to say that the print statement will be observable unless there
are an infinite number of actions that take place before it. That is to
say, unless T2 isn't executed in a finite amount of time, the print
statement will happen.

So we say that the only external actions that can be observed are those
that have a finite number of actions before them.

The problem with this is that thread-local actions don't actually count as
actions in our semantics. So if you added a T3:

T3:

while (true);

T3 could be scheduled infinitely, but that scheduling would not count as
part of the infinite number of actions that took place before the
observable action. So we added an action that allows an infinite number
of local actions. That's what the catatonia action is.

> Certainly a compiler noticing that at some point code is going into an
> infinite loop that does nothing could replace the infinite loop with some
> kind of "suspend". But I hope we can justify that as an optimization of the
> normal semantics without resorting to discussing any special actions.

See above. The compiler is free to replace this code without considering
the catatonia action.

                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:06 EDT