[R] smp in Linux

Thomas Lumley thomas at biostat.washington.edu
Mon Aug 28 17:39:01 CEST 2000

On Mon, 28 Aug 2000, Vlad wrote:

> Hello,
> I checked mail list archives and this topic came up before in March '99
> (about ability of R to multithread).
> At that time rossini at biostat.washington.edu (Tom Rossini) 

(?Tony Rossini). He's not doing it.

> suggested to check his web page in a few month as it was on
> his list to-do.  I checked but the web page is not valid.
> I wanted to know if in general progress has been made in the area,
> or if it is planned.
> I was also wondering if it is possible to use R from a C++ program.
> Specifically if it is possible to ask R to run a given R-program
> from withing a posix thread (on linux) without providing a Mutex that
> would serialise access to R process.

No. You need to make sure that only one thread calls R, which means having
some sort of handler to queue the commands.  This is what we do for 
Tcl/Tk events and (I believe) for the Windows GUI.  

I don't think there are any plans to thoroughly multithread R.  Having
a few bits of it run on separate threads has been suggested, but
multithreading the whole thing would be difficult.

> I am asking because for performance reason, I would like
> to read and manipulate sample data in a multithreaded
> C++ program, while living the stat. analysis for R.  (I  do not
> want to format data, dump it in to a file and then read it back from R.
> The disk (I/O) activities in such approach is too time consuming.  I
> would
> however use shared memory regions, if R allows to read data from there.)

You can read and write directly into R objects (documented in "Writing R
Extensions") as long as you are careful about the garbage collector.
> Unrelated question: is the above possible with Splus v. 5?

This is not the best place to ask this question. I think the answer is
no. Duncan Temple Lang got S version 4 to multithread (or nearly?) but I
don't think S-PLUS ever has.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list