Rthreads: Rthreads

RthreadsR Documentation

Rthreads

Description

Utilties to implement threads programming in R.

Usage

rthreadsSetup(nThreads, sharedVars = NULL,  mutexNames = NULL, 
   infoDir = '~/')
rthreadsAtomicInc(sharedV,mtx='mutex0',increm=1)
rthreadsAttachSharedVar(varName,infoDir='~/')
rthreadsInitBarrier()
rthreadsMakeBarrier()
rthreadsMakeSharedVar(varName,nr,nc,infoDir='~/',initVal=NULL)
rthreadsWaitDone()
rthreadsAttachMutex(mutexName,infoDir='~/')
rthreadsBarrier()
rthreadsJoin(infoDir= '~')
rthreadsMakeMutex(mutexName,infoDir='~/')
quickstart()

Arguments

nThreads

Number of threads.

sharedVars

Quoted names.

mutexNames

Quoted names.

infoDir

Directory containing the shared objects.

sharedV

Quoted name.

mtx

Quoted name.

increm

Amount to add to shared variable. Can be a vector.

varName

Quoted name.

nr

Number of rows.

nc

Number of columns.

mutexName

Quoted name.

initVal

Initial value of shared variable.

Details

One sets up terminal windows, one for each thread. In the first window, one calls rthreadsSetup, then rthreadsJoin in each window.

Shared variables must be of matrix type (a restriction of bigmemory). One creates them via rthreadsMakeSharedVariable in one window (optionally in rthreadsSetup), then calls rthreadsAttachSharedVar in the other windows to share them.

Type 'quickstart()' for detailed examples.

Author(s)

Norm Matloff


matloff/Rdsm documentation built on June 13, 2025, 8 p.m.