[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Synchronized attr_accessor

MenTaLguY

6/11/2007 7:42:00 PM

On Tue, 12 Jun 2007 04:23:35 +0900, "Nasir Khan" <rubylearner@gmail.com> wrote:
> - Is it true for Ruby today?

Depends on which implementation of Ruby. For Ruby 1.8, with its green threads, no. For XRuby, yes. For JRuby, yes. For Rubinius, no. IronRuby, yes. Ruby.NET, yes. YARV/1.9, no.

> - If not then will it ever be true in future?

It will be also be true of Rubinius once it adds support for native threads. It will also be true of YARV/1.9 if and when the Big Scheduler Lock is abandoned.

> - Is there some text somewhere where Ruby memory model for interpreter
> developers?

No. There probably ought to be.

> - Since Ruby doesnt have a volatile keyword does it mean that all variable
> access is essentially non-volatile?

Yes, but even the volatile keyword doesn't do what you expect. Despite widespread folklore, volatile by itself is _not_ sufficient to ensure thread safety -- you need to use operations which include memory barriers (generally by using the provided synchronization primitives).

Incidentally, the environments where double-checked locking actually works are also the ones where it gives the least performance gain.

-mental