children {multicore}R Documentation

Functions for management of parallel children processes


children returns currently active children

readChild reads data from a given child process

selectChildren checks children for available data

readChildren checks children for available data and reads from the first child that has available data

sendChildStdin sends string (or data) to child's standard input

kill sends a signal to a child process


readChildren(timeout = 0)
selectChildren(children = NULL, timeout = 0)
sendChildStdin(child, what)
kill(process, signal = SIGINT)



if omitted, all active children are returned, otherwise select should be a list of processes and only those form the list that are active will be returned.


child process (object of the class childProcess) or a process ID (pid)


timeout (in seconds, fractions supported) to wait before giving up. Negative numbers mean wait indefinitely (strongly discouraged as it blocks R and may be removed in the future).


list of child processes or a single child process object or a vector of process IDs or NULL. If NULL behaves as if all currently known children were supplied.


character or raw vector. In the former case elements are collapsed using the newline chracter. (But no trailing newline is added at the end!)


process (object of the class process) or a process ID (pid)


signal to send (one of SIG... constants – see signals – or a valid integer signal number)


children returns a list of child processes (or an empty list)

readChild and readChildren return a raw vector with a "pid" attribute if data were available, integer vector of length one with the process ID if a child terminated or NULL if the child no longer exists (no children at all for readChildren).

selectChildren returns TRUE is the timeout was reached, FALSE if an error occurred (e.g. if the master process was interrupted) or an integer vector of process IDs with children that have data available.

sendChildStdin sends given content to the standard input (stdin) of the child process. Note that if the master session was interactive, it will also be echoed on the standard output of the master process (unless disabled). The function is vector-compatible, so you can specify more than one child as a list or a vector of process IDs.

kill returns TRUE.


This is a very low-level API for expert use only. If you are interested in user-level parallel execution use mclapply, parallel and friends instead.


Simon Urbanek

See Also

fork, sendMaster, parallel, mclapply

[Package multicore version 0.1-8 Index]