[R] Changing the name of the "R" process in top

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun May 29 11:04:24 CEST 2011


On Sat, May 28, 2011 at 7:48 PM, Matthew Keller <mckellercran at gmail.com> wrote:

> Perhaps this is more of a unix question, but I'll give it a try here.
> I am running 9 different R processes at the same time (called from a
> shell script using R CMD BATCH).  When I use the top program to
> monitor how they are doing, it is impossible to tell which R process
> is related to which R script. Is there a way to rename a specific
> instantiation of an R process in top with another, more informative
> name, e.g., something like R-script1 R-script2 etc?

 man prctl:

  PR_SET_NAME (since Linux 2.6.9)
              Set the process name for the calling process, using the
value in the location pointed  to  by  (char *)
              arg2.  The name can be up to 16 bytes long, and should
be null terminated if it contains fewer bytes.

 so if you have a linux >=2.6.9 system you can call this from some
dynamically loaded C code. Beware the 16 byte restriction, and make
sure you don't free the memory being pointed to...

Barry



More information about the R-help mailing list