David Holmes wrote:
> I still have concerns over how sync block merging can be specified such that
> the "fairness" issues Bill mentioned can be dealt with. The classic example
> is:
> 
>   readlock.acquire();
>   // access data structure
>   readlock.release();
> 
> Both acquire and release are "sync blocks" but I certainly don't want them
> to be merged.
Being possibly the first person to attempt this, here's how'd I
do it: I'd require that the stuff in comments:
   " // access data structure"
be provable finite (better: short) duration.
Easy way to do this: don't coarsen the lock if there's a loop.
This rules out:
     BEFORE                   AFTER
    for(...) {               lock(X);
      lock(X);               for(...) {
      ...                       ...
      unlock(X)              }
    }                        unlock(X)
But does NOT rule out:
    for( ...; i += 8 ) {
      lock(X)
      ...8 copies of loop body...
      unlock(X)
    }
Cliff
-- Dr. Cliff Click Chief Architect, HotSpot Server Sun Microsystems, Inc. Cliff.Click@Sun.COM Senior Staff Engineer 4150 Network Circle (408) 276-7046 MS USCA14-102 Santa Clara, CA 95054------------------------------- JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:39 EDT