[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads



On Fri, 18 Jun 1999, Michael Day wrote:

> 
> > AFAIK linux kernel < 2.2 has no process affinity (and, thereby no
> > pthread affinity). I do not think even the newer kernels has it.
> 
> Pity, this could be a useful feature to watch out for in forthcoming
> kernels, perhaps. At least in linux we can (theoretically) jump in and
> code it ourselves :) Maybe could post off some questions to a kernel
> hacker somewhere and see if some root level affinity functions would screw
> things up or not, presumably you wouldn't want just any process being able
> to choose what the cpus should do... although a simple "hinting" mechanism
> could work, two threads ask to run on different cpus, and if the system
> *has* two cpus and it is feeling generous, it will allow this :)

IIRC the linux scheduler will try and place processes on the same CPU they
last ran on, to ensure cache integrity. What lacks is an option to
explicitly state ; "make this process run on CPU #".

I do not know a lot about it, but I suspect that there really isnt that
much to gain - if the system is not loaded, processes will keep getting
the same CPU - if the system is loaded, keeping a process on a single CPU
may hurt a lot more then it benefits.

Mads

-- 
Mads Bondo Dydensborg.                               madsdyd@challenge.dk
  7)  Sacrifice a small animal for Good Luck

 (step 7 of 8 in configuring the Open Source Global File System for Linux)