Posts Tagged ‘process group’

New toy: newpgid

December 13, 2011

Useful with cpusoak and memsoak,


#include <unistd.h>

main(int argc, char *argv[])
  setpgid(0, 0);

  execvp(argv[1], &(argv[1]));

  return 1;

When you want to start a new process in its own process group for easy killing.

If you have coreutils 7.0+, you can take advantage of timeout, which happens to setpgid.

%d bloggers like this: