[R] Multicore package: sharing/modifying variable accross processes

Renaud Gaujoux renaud at mancala.cbio.uct.ac.za
Fri Oct 30 13:23:03 CET 2009


Hi,

I want to parallelize some computations when it's possible on multicore 
machines.
Each computation produces a big objects that I don't want to store if 
not necessary: in the end only the object that best fits my data have to 
be returned. In non-parallel mode, a single gloabl object is updated if 
the current computation gets a better result than the best previously found.
My plan was to use package multicore. But there is obviously an issue of 
concurrent access to the global result variable.
Is there a way to implement something like a lock/mutex to ensure make 
the procedure thread safe?
Maybe something already exist to deal with such things?
It looks like package multicore run the different processes in different 
environments with copy-on-change of everything when forking. Anybody has 
experimented working with a shared environment with package multicore?

Thanks.




More information about the R-help mailing list