Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #2687
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: AtomicReferenceArray writes and visibility |
| References | <in14ae$qap$1@Gaia.teknon.de> |
| Date | 2011-03-31 20:55 -0700 |
| Message-ID | <4d954cb3$0$22142$742ec2ed@news.sonic.net> (permalink) |
| Organization | Sonic.Net |
In article <in14ae$qap$1@Gaia.teknon.de>, v_borchert@despammed.com (Volker Borchert) wrote: > Hello all, > > reading on the "new" memory model and AtomicReferenceArray, it > seems that anything done before a .set() on an AtomicReferenceArray > "happens-before" anything done after a .get() on the same > AtomicReferenceArray. > > Two questions: > > 1. Am I right? > 2. If so, does this hold true if the write does not actually change > the value, in other words, if the write only "refreshes" the > memory location? > > Thank you > > V.B. For the weakCompareAndSet methods, it's not a matter of values being set then destroyed by collisions. The difference is that when you're operating on multiple values, threads may see those values change in a different order than they are set. A multithreaded operation which requires a sequence of changes to multiple values may fail. The weak methods may also return false more often than expected. At least in my source code, the weakCompareAndSet versions have no special operation. It looks like Sun may expect that some systems can run faster when memory syncing rules are relaxed. On a multi-core Intel x86 CPU, multiple threads can't write to the same CPU block of memory at once. The only performance difference between the 'atomic' package and a 'synchronized' block is that a synchronized block caries a high risk of a thread losing it's CPU time (quanta runs out) while the lock is held. The 'atomic' operations have no such risk. -- I will not see posts from Google or e-mails from Yahoo because I must filter them as spam
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
AtomicReferenceArray writes and visibility v_borchert@despammed.com (Volker Borchert) - 2011-03-31 05:43 +0000
Re: AtomicReferenceArray writes and visibility Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-03-31 00:52 -0700
Re: AtomicReferenceArray writes and visibility v_borchert@despammed.com (Volker Borchert) - 2011-04-02 06:28 +0000
Re: AtomicReferenceArray writes and visibility Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2011-03-31 20:55 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 21:22 -0700
Re: AtomicReferenceArray writes and visibility Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-03-31 21:54 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 21:58 -0700
Re: AtomicReferenceArray writes and visibility Patricia Shanahan <pats@acm.org> - 2011-03-31 22:24 -0700
Re: AtomicReferenceArray writes and visibility markspace <-@.> - 2011-03-31 22:55 -0700
Re: AtomicReferenceArray writes and visibility Lew <lew@lewscanon.com> - 2011-04-01 11:40 -0700
csiph-web