Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 17 Jan 2012 16:50:02 -0600 Date: Tue, 17 Jan 2012 14:49:58 -0800 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Volatile happens before question References: <09848313-2372-4c23-8f52-fa84c612c100@u32g2000yqe.googlegroups.com> <1e7b4r38kmn2f$.1kwqeem7f8lxb.dlg@40tude.net> In-Reply-To: <1e7b4r38kmn2f$.1kwqeem7f8lxb.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4YydnRFXi_2GZojSnZ2dnUVZ_rKdnZ2d@earthlink.com> Lines: 36 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.11.53.36 X-Trace: sv3-c8v3BF59CxEnKTXiDgnmsq/WIv1g7WFbZlGf8KK7k4L8aUtZBJJAJxaO3w7SXWAdxAcVUx+CdjDs+HX!Jro1Ia++0kh/ahpilvuSLWp0OSqE+Cr45RxlJUDprbaTAykP6kXs47fqc7c3bGuXzgB/TjaYamTD!Nxn+3cx/pOq8/wzyobNN1Ud2FltQdwJ/pGyyJoVA6+Y= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2588 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11432 On 1/17/2012 8:17 AM, Peter Duniho wrote: > On Tue, 17 Jan 2012 04:04:52 -0800 (PST), raphfrk@gmail.com wrote: > >> The spec says that all writes to volatiles can be considered to happen >> before all subsequent reads. What does "subsequent" mean, is that >> with regards to real time? > > Essentially, yes. I believe the exact language talks about synchronization > order" or something, but the basic idea is the order in which program > statements are effectively executed. ... Even before analyzing the entire thread so far, I'm going to disagree with this comment, because it can lead to an incorrect intuition. Real time order is a total order, or can be made into one by adding a tie breaker using the processor number for events that happen on the same cycle in different processors. The potential incorrect intuition is that there is a total order of all events in a Java program. There isn't. There are a number of important partial orders: synchronization order, happens-before, and program order within a thread. The behavior of reads and writes must be consistent with the relevant partial orders, but do not have to be consistent with any one total order. The problem with imposing a total order is the amount of inter-processor communication and coordination it would require. Patricia