Re: Locking a process or thread onto a specific CPU

Pavel Machek (pavel@bug.ucw.cz)
Thu, 18 Feb 1999 23:53:50 +0100


Hi!

> > 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.

I thought that there were patches to do this? It was pretty
simple.

> 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.

su (studentname)
kill -9 -1

is the right way to do this kind of job. Well, all tasks of that
student are going to die, but I think (s)he deserved it :-).

Pavel

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

- 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/