Re: JavaMemoryModel: october JMM spec seems to break java's threading model

From: Lanchon (lanchon@hotmail.com)
Date: Fri Dec 05 2003 - 05:49:48 EST


sorry for not being able to answer sooner.

>> although java doesn't have fairness guarantees for good reasons, i
>> think it intends to have a kind of execution guarantee, something like
>> "at least one thread of the set of currently runnable threads will
>> make progress" (is it written somewhere?)
>
>No, and it would surely not hold in most (all?) JVMs in which
>prgrammer-visible threads do not progress during stop-the-world GC,
>sometimes during JIT compilation, or just because the OS didn't give
>the JVM any cycles.

of course this is true, but i didn't mean "will make progress all the time", i ment "will eventually make progress".

>So, I think the premise of your arguments, that spurious wakeups
>nullify prgress guarantees does not hold.

that's true, since there are no progress guarantees. my argument was more pointed to the fact that spurious wakeups complicates the definition of progress guarantees, by RT spec or by VM implementor.

>Before doing so, it is worth mentioning a general bias of some of us
>on this list. Ever since spuriousness was first introduced in early
>DEC SRC papers/systems (firefly, mesa, modula-3), many of us have
>bought into the notion that spuriousness is a good property, for
>software engineering reasons that other people may find perverse: The
>potential for spurious wakeups makes it ALWAYS wrong to not use wait
>inside a loop that checks the condition being waited on, as opposed to
>merely ALMOST always wrong. This makes it easier to enforce good
>design/coding practices.

"signals as hints" is a good coding practice around no priority monitors. that said, and also knowing there are good reasons for spuriousness, i have to strongly disagree with some posters who went so far as to say that forcing that coding practice was a "reason" to have spuriousness. spuriousness in not that bad, planting an unnecessary bomb in the spec to make me code "right" is creepy, but what's really perverse is to be unmindful of writing it down in the javadoc for Object.wait().

:)

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



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