Re: CPU assignment in ProcessBuilder
Roedy Green wrote:
On Sun, 31 May 2009 17:42:20 -0700 (PDT), Simon Chen
<firstname.lastname@example.org> wrote, quoted or indirectly quoted someone who
I am trying to use ProcessBuilder to create a child process in java.
However, I want to be able to lock that child process to a particular
CPU. Basically, that process only runs on a designated core, similar
to using sched_setaffinity() under C/C++. Is there a way of doing so?
This question came up a while back. The responses were of two
1. no you can't
2. why would you want to?
Elaborating on #2: There are perfectly good reasons to want to
assign a particular activity to a CPU or set of CPUs. *But* those
reasons, in my experience anyhow, are always framed in terms of the
behavior of the total system and not of a small set of activities
running on it. The inputs to the assignment are policy decisions
made by the system operator, and these are largely unknown and
unknowable to the program.
The program might say "I'll run faster if I devote CPU X to
task A and CPU Y to task B." Fine, but the program doesn't know that
the system operator has already decided to devote CPU Y to handling
the device interrupts from the 10Gbit network card, and that CPU Y
therefore has very little capacity left for running task B. Result:
The program runs less well than it thought it would while hurting
the entire system's network performance.
Leave resource allocation to the owner of the resources, and
don't let the least-informed piece of the total system make the