[R] Threaded R-Java

Duncan Temple Lang duncan at research.bell-labs.com
Tue Sep 24 20:44:25 CEST 2002


nathan whitehouse wrote:
> Hello all,
> 
>   We currently have a java web utility that allows
> multi-threaded data analysis using S+.

Is the Java utility multi-threaded and talking to different S-Plus
processes? or are you talking to a single S-Plus process that is
itself multi-threaded?  If it is the latter, I am happily suprised;
but I very much doubt that S-Plus is entirely thread-safe at this
point or even supports threads.  If you are using threads within
S-Plus to execute S code, I would very much like to hear more about
it. Typically one just runs the same code in different S-Plus
processes and have them report back to the multi-threaded daemon that
manages the comunication from the client to the S-Plus server.

> 
>   We want to migrate it to R.  However, the guy who
> preceded me here left some documentation indicating
> that he couldn't implement it because R didn't support
> threading.  Also, he noted that the R-Java
> interface(org.omegahat.R.Java.REvaluator) wasn't
> thread safe even if R was. 

Without knowing the details of your system, my guess would be that R
and S-Plus provide the same level of support for a threaded
application; basically they don't. (There are a several ways to get
asynchronous events in either system, but not threading!)
So, I would imagine that your setup will work with R as well as
it does with S-Plus but there will be some practical
details to sort out.

The R-Java interface is basically thread safe. One can create
different instances of the REvaluator class and they will act
independently.  They can share objects, but will typically do so via
Databases and so will be synchronized correctly.

However, the guts of the REvaluator class is the collection of 
native routines that allow it to access the R evaluator.
Since the R evaluator is not thread-safe, the REvaluator
class must serialize access to the evaluator. So the REvaluator
code is basically thread-safe, but the underlying system is not.

Threads  and synchronization can be very tricky and require an
explicit model to work correctly.  


> 
>   Can anybody who knows about this comment on it?  I'd
> like to know if this is completed(his documentation
> claimed it was a work in progress?)
> 
>   Thanks a bunch,
> 
>   Nathan Whitehouse
>   Programmer
>   Shaw/Shaulsky Lab
>   Baylor College of Medicine
>   Houston, TX, USA
> 
> 
> __________________________________________________
> 
> New DSL Internet Access from SBC & Yahoo!
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
_______________________________________________________________

Duncan Temple Lang                duncan at research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       
         http://cm.bell-labs.com/stat/duncan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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