[R] running R command in the background

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jun 4 22:46:49 CEST 2004


Did you try actually reading the request (let alone the informed 
repsonse you included) ...

> I want to do this in the same session, rather than with multiple calls 
to R,

whereas package fork's DESCRIPTION says

Description: These functions provides simple wrappers around the Unix
        process management API calls: fork, wait, waitpid, kill, and
        _exit.  This enables construction of programs that utilize
        multiple concurrent processes.

exactly what was *not* asked for.


On Fri, 4 Jun 2004, Andrew Young wrote:

> By "library" I of course mean "package".
> 
> -Andrew
> 
> 
> --- Andrew Young <youngas7 at yahoo.com> wrote:
> > 
> > You could try looking at the library "fork". 
> > However,
> > this generally sounds like a bad idea and if you do
> > this, you're kind of asking for trouble with
> > threading
> > issues, as R is not thread-safe.
> > 
> > I'm not sure if fork works on all platforms, since I
> > believe it works by running a unix shell command.
> > But
> > it's worth a shot.

Only for zero marks.

> > 
> > Best regards,
> > -Andrew
> > 
> > 
> > --- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> > > This cannot presently be done, as the R internals
> > do
> > > not multitask.  I am 
> > > not sure what you would want to happen if the
> > > background and foreground 
> > > commands both tried to write a new version of
> > object
> > > `foo', BTW.
> > > 
> > > Allowing multiple execution threads and
> > setReader()
> > > as described in the
> > > Green Book is a design goal and has been since
> > 2001
> > > at least, so don't
> > > expect it soon.  It is hard (lots of the code
> > used,
> > > e.g. LINPACK, is not
> > > reentrant and so needs to be semaphored) and if
> > > achieved will need
> > > vigilance to keep working.
> > > 
> > > On Fri, 4 Jun 2004, Bickel, David wrote:
> > > 
> > > > Is there a way to call an R function to work in
> > > the background within
> > > > the same R session? What I have in mind is the
> > > equivalent of adding '&'
> > > > at the end of a UNIX command, so that R can
> > > process an intensive command
> > > > while I execute other R commands. I want to do
> > > this in the same R
> > > > session, rather than with multiple calls to R,
> > so
> > > that all my modified
> > > > objects will stay in the same workspace.
> > > > 
> > > > I would appreciate any help with this.
> > > 
> > > -- 
> > > Brian D. Ripley,                 
> > > ripley at stats.ox.ac.uk
> > > Professor of Applied Statistics, 
> > > http://www.stats.ox.ac.uk/~ripley/
> > > University of Oxford,             Tel:  +44 1865
> > > 272861 (self)
> > > 1 South Parks Road,                     +44 1865
> > > 272866 (PA)
> > > Oxford OX1 3TG, UK                Fax:  +44 1865
> > > 272595
> > > 
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > >
> >
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> >
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list