JavaMemoryModel: Re: Question regarding nested synchronized blocks

From: Joseph Bowbeer (
Date: Tue Apr 23 2002 - 19:07:22 EDT

David Holmes writes:

> But if I'm the lone voice that thinks this is a problem,
> then perhaps its not a problem after all

David, I think your concerns are shared by most programmers -- and I think
you're doing a great job of representing us :-)

I'm not certain that the optimizations will break anything important, but at
the same time I'm concerned they might. I'm waiting until I hit on a good
example (or it hits me) before I jump into action.

----- Original Message -----
From: "David Holmes" <>
To: "jmm" <>
Sent: Tuesday, April 23, 2002 3:22 PM
Subject: RE: JavaMemoryModel: FWD: Question regarding nested synchronized

>Cliff Click wrote:
>> The issue is wheither any interesting program can have some nearby locks
>> that are candidates for coarsening, the locks are only lightly contented
>> but are heavily used so that any coarsening causes a lot of contention.
>> And, of course, it's only coarsening that does you in; moving to next
>> year's machine where N is 2x larger somehow doesn't make these locks get
>> all hot & contended. I'll hand-wave and claim this set of programs is
>> fairly small. :-)
>> I'll even hand-wave a solution: if the coarsened lock gets contended,
>> HotSpot can recompile with the coarsening turned off for those locks.
>Perhaps this is also mitigated by the prospect of JSR-166 having real R/W
>locks that can be natively implemented and not consist of nearby
>synchronized regions and hence not be subject to coarsening ?
>My problem with playing around with the contents of synchronized blocks may
>be more of an academic one than a practical one. But it seems to me that
>reasoning about the behaviour of programs is hard enough when you know what
>the code does, so reasoning about concurrent programs when what you see in
>the code is not what you get, becomes impossible. But if I'm the lone voice
>that thinks this is a problem, then perhaps its not a problem afterall.

JavaMemoryModel mailing list -

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