Sharing in D

superdan super at dan.org
Thu Jul 31 22:36:36 PDT 2008


Walter Bright Wrote:

> Sean Kelly wrote:
> >> Java has synchronization and volatile, and it isn't good enough.
> > But volatile in Java is completely different.  And Java doesn't support inline
> > ASM.  That said, Java post JSR-133 (ie. Java today) is actually fine.  The C++
> > 0x people simply didn't copy Java because the Java memory model is too
> > strict to appease the performance-crazed folks in the group :-)
> 
>  From talking to people who do large scale multithreaded Java programs, 
> it is not fine. The problem is that there is no way to look at a 
> non-trivial piece of code that you didn't write, and determine if it has 
> dependencies on sequential consistency or not.
> 
> I'm not arguing that a thread expert cannot make a thread correct 
> program in Java and C++. They can. The problem is the inability to 
> verify such correctness, no help is available from the language, and the 
> dearth of such experts.
> 
> 
> > So "shared" will tell the compiler to automatically fence, etc?
> 
> Yes.

yech. so i write this:

++a;
++b;
++c;

and very different code comes down the pike depending on a or b or c being shared. not easy to clarify the code is correct. this ain't cool.



More information about the Digitalmars-d mailing list