Re: Locking a process or thread onto a specific CPU

Alexander Kjeldaas (astor@fast.no)
Thu, 18 Feb 1999 16:36:50 +0100


On Tue, Feb 16, 1999 at 04:00:20PM +0000, Steve Linton wrote:
>

> Is there any way to do this with the 2.2 SMP code? A colleague is
> implementing his own language for research purposes and wants, in
> effect, to schedule his own threads on the available CPUs. The
> obvious way to do this seems to be to run one "real" thread locked
> onto each CPU. I know that threads will typically stay on the same
> CPU they were on anyway, but I can imagine an ill-timed intervention
> of a third process (in the case of 2 CPUs) resulting in both his
> processes trying to run on the same CPU.
>
> If this is not possible at the moment, can anyone (a) comment on its
> feasibility (b) advise us on where to look to implement it or (c)
> comment on its desirability as a new feature.

I think this is very desirable. It is also desirable to be able to
disable some CPUs. I have one example where this kind of flexibility
is desirable.

We ran a 4-CPU SGI machine a while back. It was used by students and
obviously they did lots of weird things with it. Once in a while, a
student would write a program that essentially forked in a loop where
the parent process exited. This kind of process is _hard_ to kill
since neither is it visible using 'ps', nor is the PID constant. In
IRIX, it is easy to solve this problem by disabling 3 CPUs, and
scheduling your shell as a real-time process. Alternatively, you can
allocate one CPU to the OS, one for your shell, and disable the other
processes. None of this is possible in Linux. In Linux, on a 4-way
SMP system, you're stuck.

astor

-- 
 Alexander Kjeldaas, Fast Search & Transfer

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/