Re: JavaMemoryModel: PC language alert: catatonia action

From: Jerry Schwarz (jerry.schwarz@oracle.com)
Date: Sun May 16 2004 - 21:15:53 EDT


At 02:47 PM 5/16/2004, Jeremy Manson wrote:
> > 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.

The print statement occurs if T2 and T1 are scheduled. If you don't want to
"say anything about scheduling" then you can't say that it occurs.

I don't understand what this has to do with the memory model and I continue
to believe that JSR 133 should say nothing about fairness or scheduling.

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

I don't understand this. I thought we had agreed not to talk about infinite
computations.

I've always thought that what you're calling "external actions" should be
explicit operations in the execution. Then this becomes tautological. The
only operations that occur in an execution are those that occur in the
execution.

>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.

Are you saying in the presence of T3 you still want to guarantee the print
occurs? That is definitely a statement about scheduling.

> > 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