<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 2:09 PM, Remi Forax <span dir="ltr"><<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><span class="">
    <br>
    <div>On 10/08/2014 12:51 PM, √iktor Ҡlang
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Sounds really bad if this is the case. I can
        totally understand eliding locks that are re-taken in a nested
        fashion, but coarsening in terms of coalescing neighboring
        acquisitions seems dubious.<br>
      </div>
    </blockquote>
    <br></span>
    even in this case,<br>
    class Foo {<br>
      public synchronized void setBar(Bar bar) { ... }<br>
      public synchronized void setBaz(Baz baz) { ... }<br>
    }<br>
    ...<br>
      Foo foo = ...<br>
      foo.setBar(bar);<br>
      foo.setBaz(baz);<br>
    <br>
    because sadly this code is very common :(<br></div></blockquote><div><br></div><div>Agreed. The case above is not really problematic since there are no invocations/reads/writes in between.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    <br>
    Rémi<div><div class="h5"><br>
    <br>
    <blockquote type="cite">
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Oct 8, 2014 at 12:19 PM,
          thurstonn <span dir="ltr"><<a href="mailto:thurston@nomagicsoftware.com" target="_blank">thurston@nomagicsoftware.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
            <br>
            If I read the  jsr-133 cookbook<br>
            <<a href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html" target="_blank">http://gee.cs.oswego.edu/dl/jmm/cookbook.html</a>> 
             correctly, given the<br>
            following:<br>
            <br>
            <br>
            <code><br>
            //y is a global, non-volatile<br>
            enter monitor x<br>
            ...<br>
            //do some work not involving y<br>
            . . .<br>
            exit monitor x<br>
            y = 43<br>
            <br>
            </code><br>
            <br>
            then at least according to the JMM, the following execution
            is possible:<br>
            <code><br>
            //y is a global, non-volatile<br>
            enter monitor x<br>
            ...<br>
            //do some work not involving y<br>
            y = 43<br>
            exit monitor x<br>
            </code><br>
            <br>
            as in the first table in the cookbook, *normal stores* are
            allowed to be<br>
            re-ordered before a *monitor exit* (but not before a
            *monitor enter*).<br>
            <br>
            Although the issue isn't really one involving memory
            consistency, is that<br>
            really allowed?  Because *increasing* the size of a critical
            section seems .<br>
            . . I don't know . . . unhealthy.<br>
            What if the program code computed the first 1000 prime
            numbers or something<br>
            and wrote them to a global array (after the monitor exit)?<br>
            <br>
            I was always under the impression that only the operations
            specified within<br>
            a critical section would actually be executed between the
            enter/exit monitor<br>
            pair<br>
            <br>
            NB: Although, presumably the runtime/CPU would only do this
            if the critical<br>
            section was leading to CPU stalls or the like and so in
            reality, not really<br>
            producing a longer critical section execution time<br>
            <br>
            <br>
            <br>
            <br>
            --<br>
            View this message in context: <a href="http://jsr166-concurrency.10961.n7.nabble.com/JSR-133-Cookbook-and-exit-monitor-tp11323.html" target="_blank">http://jsr166-concurrency.10961.n7.nabble.com/JSR-133-Cookbook-and-exit-monitor-tp11323.html</a><br>
            Sent from the JSR166 Concurrency mailing list archive at
            Nabble.com.<br>
            _______________________________________________<br>
            Concurrency-interest mailing list<br>
            <a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
            <a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        <div dir="ltr">
          <div><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Times;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
              <div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">Cheers,</div>
              <div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">√</div>
            </span></div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Concurrency-interest mailing list
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Times;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">Cheers,</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">√</div></span></div></div>
</div></div>