Re: Interview Questions
- From: Daniel Pitts <newsgroup.spamfilter@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 08 Nov 2008 17:44:13 -0800
Lew wrote:
Lew wrote:Heh, I mis-wrote it actually. I *meant* the converse of what I wrote.Daniel Pitts wrote:Q: What is the affect of the volatile keyword in Java 1.5? Has it changed since 1.2?
A: In java 1.5, the a read from a volatile happens-before the write of the value that was read. This is not necessarily the semantics of volatile before 1.5.
Very summarized and, of course, completely correct.
Drat, I misread the post and misspoke. It is not completely correct. Daniel's statement is actually not at all correct. Arne's post woke me up.
A write from thread A to a volatile variable that precedes a read from thread B /happens-before/ that read, and all writes of any variables from A that preceded the write to the volatile variable from A /happen-before/ all reads of any variables from B subsequent to that read of the volatile in B.
A write to a volatile happens-before the read of the value that was written.
Oops. Other than a little dyslexia, I was correct :-)
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
.
- Follow-Ups:
- Re: Interview Questions
- From: Lew
- Re: Interview Questions
- References:
- Interview Questions
- From: Ken T.
- Re: Interview Questions
- From: Daniel Pitts
- Re: Interview Questions
- From: Lew
- Re: Interview Questions
- From: Lew
- Interview Questions
- Prev by Date: Re: Possible bug in Calendar
- Next by Date: Re: update/change java.util.Map key in place
- Previous by thread: Re: Interview Questions
- Next by thread: Re: Interview Questions
- Index(es):
Relevant Pages
|