[Nottingham] Multi-processor machines

Mike Cardwell lug at blubbernet.com
Wed Feb 9 23:33:23 GMT 2005


On Wed, 9 Feb 2005, Graeme Fowler wrote:

>> Because the processing can potentially use a lot of memory, a queue is
>> created and one image is processed at a time to stop the machine from
>> thrashing it's swap.
> ...OK, this is reasonably sensible if your system doesn't have enough physical
> RAM to do multiple simultaneous jobs.
>> I am soon going to have access to a machine with dual cpus. It would make
>> sense to have both cpus working on separate images simultaneously.
> But...
>> My question is, is it possible with Linux to force processes to run on
>> particular CPU's? Or am I missing the point entirely?
> ...if RAM is your problem, how is using two CPUs going to help? If you run up
> two simultaneous processing threads then surely (from your single process
> model) you're going to end up in thrashland?

The current box could handle two jobs at the same time, but it does them 
no faster than doing one after the other. Add a third job, and swap gets 
used and the whole thing gets much slower.

The new box will have a lot more Ram than the current box. It only needs 
to have enough ram to do two jobs at any one time anyway seeing as there 
is no speed advantage of each cpu doing more than one job at any time.

>> I doubt it makes any difference, but the program I'm using is something I
>> wrote my self in perl.
> IIRC there's a couple of ways (but I can't remember the detail, and it may
> have changed again in 2.6) you can force jobs to run on a specific CPU, but as
> a lot of people have spent an awful lot of effort and time getting the SMP
> schedulers right inside the kernel in my experience it's better to let the
> schedulers do the job for you.

I was hoping to have a server written which would fork off a separate 
process for each cpu on startup, and then could pass jobs onto each of 
these cpus as they became "idle". both of the forked processes could end 
up on the same cpu at startup though and all of the jobs would then be 
done on just the one.

However, I suppose I could fork off a separate process for each job as it 
comes in and smp might handle it better.

I could work around the problem of not being able to choose a cpu if a 
particular process could identify which cpu it was running on too. That 
must be possible.

> If you have a DP box, you get twice the queue length for a given load average
> as there's double the headroom for running processes waiting for CPU (think
> PHP scripts, you've actually seen this a lot!).

Eurgh. Queues of php processes.

> What I've often seen is that attempts to force jobs onto a specific CPU will
> get overridden in kernel space anyway. Shame I can't remember the detail; I
> think a trawl of LKML might help you out a bit here.

Will do some more research I think. The most worrying thing is that I 
can't find a perl module to help me. If there isn't a perl module for 
something already, it's probably impossible to do ;)

Mike



More information about the Nottingham mailing list