Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 9813 invoked from network); 3 Oct 2006 18:48:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Oct 2006 18:48:07 -0000 Received: (qmail 98704 invoked by uid 500); 3 Oct 2006 18:48:04 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 98658 invoked by uid 500); 3 Oct 2006 18:48:03 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 98647 invoked by uid 99); 3 Oct 2006 18:48:03 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Oct 2006 11:48:03 -0700 Authentication-Results: idunn.apache.osuosl.org header.from=t.p.ellison@gmail.com; domainkeys=good X-ASF-Spam-Status: No, hits=0.5 required=5.0 tests=DNS_FROM_RFC_ABUSE DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 Received: from [66.249.92.172] ([66.249.92.172:32400] helo=ug-out-1314.google.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id F7/68-08153-160B2254 for ; Tue, 03 Oct 2006 11:48:02 -0700 Received: by ug-out-1314.google.com with SMTP id y2so851551uge for ; Tue, 03 Oct 2006 11:47:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=dQbkjrobem6qBP7Qc7w9tW6YlQzV5+wnk4boVxgF8SHouW8VUSMWAK4xoC8zmQJavRkSIF/sR6aX4KlkjpBz9DHtwCcLcNfb2OUWBaMqAa0rhx+HwkabsmE3aYo8B+qUgcdjvD04TwCySA+k5gikIxtBIIwI2ODD0tG+4DSwLnE= Received: by 10.66.220.17 with SMTP id s17mr4117081ugg; Tue, 03 Oct 2006 11:47:58 -0700 (PDT) Received: from ?192.168.0.2? ( [85.133.120.161]) by mx.gmail.com with ESMTP id 72sm5758227ugb.2006.10.03.11.47.56; Tue, 03 Oct 2006 11:47:56 -0700 (PDT) Message-ID: <4522B05B.4010303@gmail.com> Date: Tue, 03 Oct 2006 19:47:55 +0100 From: Tim Ellison User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [classlib] Recognizing lock objects References: <4522907F.7070203@gmail.com> <4dd1f3f00610031033s48e47682ta2db1934cf6522ec@mail.gmail.com> <4522A205.2060406@pobox.com> <4522A2C7.3070808@pobox.com> In-Reply-To: <4522A2C7.3070808@pobox.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Yep, you've got it. Regards, Tim Geir Magnusson Jr. wrote: > > > Geir Magnusson Jr. wrote: >> I don't think the goal is performance, but just being able to monitor >> what sync blocks are hot via watching the sync objects. > > What I meant to say was that it's not the performance of the lock > objects themselves, but the overall performance of the code that uses > it, hence looking for a better way to identify "hot" lock objects. > > And therefore, I now grok why we can't have a global one. :) > >> >> geir >> >> >> Weldon Washburn wrote: >>> Tim, >>> >>> I suspect there may be some JVM internal lock design issues involved >>> in what >>> you are suggesting. In specific, I vaguely remember a paper written by >>> David Bacon that describes lock optimization heuristics based on the >>> observation that most of the time, the object being locked is an >>> instance of >>> a "synchronized" class. >>> >>> Maybe it makes sense to build a microbenchmark of what you are >>> suggesting >>> and run it on several different JVMs? Maybe it makes sense to prototype >>> Java locking code in a way that VM fat/thin locks like best?? >>> >>> I suspect that your initial goal is classlib performance only. I'd >>> like to >>> see if we can expand this to JVM-wide system performance. Otherwise >>> we run >>> the risk of re-optimizing the whole stack and re-opening the classlib >>> lock >>> design at a later date. :( >>> >>> >>> >>> >>> >>> On 10/3/06, Tim Ellison wrote: >>>> >>>> There are a number of places in the class library code where we create >>>> an object solely to use as a synchronized block 'lock'. >>>> >>>> For example, in RandomAccessFile we define a >>>> >>>> private Object repositionLock = new Object(); >>>> >>>> then in a number of methods >>>> public int read().. >>>> .. >>>> synchronized(repositionLock) { >>>> ... >>>> } >>>> >>>> you get the idea. >>>> >>>> Using an instance of Object makes it hard to see (in profiling tools) >>>> which lock objects are 'hot', or how often a particular lock object is >>>> used. >>>> >>>> I'd like to replace the generic Object instance with a private type >>>> just >>>> for the purpose, like this: >>>> >>>> private class RepositionLock {} >>>> private Object repositionLock = new RepositionLock(); >>>> >>>> The usage would be the same, but it will then be easier to see if >>>> RandomAccessFile$RepositionLock becomes a choke point. >>>> >>>> Any objections or improvements to this proposed 'pattern' and >>>> putting it >>>> into various places throughout the class library? >>>> >>>> Regards, >>>> Tim >>>> >>>> -- >>>> >>>> Tim Ellison (t.p.ellison@gmail.com) >>>> IBM Java technology centre, UK. >>>> >>>> --------------------------------------------------------------------- >>>> Terms of use : http://incubator.apache.org/harmony/mailing.html >>>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org >>>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org >>>> >>>> >>> >>> >> >> --------------------------------------------------------------------- >> Terms of use : http://incubator.apache.org/harmony/mailing.html >> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org >> For additional commands, e-mail: harmony-dev-help@incubator.apache.org >> > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > -- Tim Ellison (t.p.ellison@gmail.com) IBM Java technology centre, UK. --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org