ps - report on the status of a subset of process's user level threads


ps(thread, class, attributes)


either a character vector of thread names to return or a function taking one argument. In the latter case, this function is applied to each of the threads and those for which this function evaluates to T are returned.

This is the same argument as thread in threads(). If this and the class argument are missing, all threads in the process are considerd.

If this is supplied as character vector, threads of any class (checked by is()) contained in this vector are returned. Alternatively, a function of one argument can be passed which evaluates a thread and returns T if the thread is of interest or F otherwise, as in thread.

This is the same argument as class in threads()

the subset of available attributes to be retured. This is a set of indicators that determine whether a given attribute is to be returned. This can be specified as a character vector or integer values corresponding to the values in psAttributes. Partial matching is used in the attribute names against the names of the vector psAttributes.So the complete names of the attributes do not have to be specified, but should be for clarity.


We have the thread and class arguments as filters if required to be consistent with the threads function. In general, that should be used to identify threads of interest. However, in xps, we re-evaluate the call to ps() periodically and want to find new threads matching particular criteria. Accordingly, the arguments to ps must be symbolic. We can still use ps to examine a fixed set of thread instances without including new or removing deleted threads. This is the necessary "latezy" (re)evaluation :-).

Return Value:

The object returned from this function is of class and describes the state of the evaluator manager's threads at a given moment. It should be noted that one cannot use the values returned here as exact measures on the threads resources since these may have changed by the time the call to ps has been completely evaluated. At the point in time when each thread's resources is gathered, those values are correct. However, as the resources for another thread are computed, other threads, including the original thread, can proceed (unless suspended) making the original statistics out of date. So caution should be exercised when comparing the properties of different threads and the related expressions in terms of efficiency, etc. This is the usual problem with multi-user and multi-process operating systems with several "jobs" running "simultaneously". Of course, the user can invoke suspend(wait=T) prior to calling ps() and so make all other threads pause, thus getting a more accurate view of the current state of the process.

See Also:



      > ps()
      <OUTPUT ...>

Key Words:

User Level Thread Management

Last modified: Mon Feb 10 18:31:40 1997