Setting processor .....affinity?

sigmend

[H]ard|Gawd
Joined
Aug 6, 2003
Messages
1,303
I have been reading and it seems like it is kinda hard to implement.
Anyone been able to do it? How?

Config: G5DP2.0/1536MB400/160/SD/R9600/PCI-X
 

kc8apf

Limp Gawd
Joined
Jul 1, 2002
Messages
140
The darwin kernel (based on mach) does not have processor affinity support.

This should be too much of an issue. Unless you are running processes that a) use 100% CPU for long periods of time and b) use a fairly consistant set of data while doing it, you're not going to notice any difference.

Essentially you would have to download the darwin kernel, hack in processor affinity, rebuild the kernel, copy the kernel over and reboot. All of that is easy except for adding in the processor affinity. If someone has a patch to do it, that'd be a simple way, but I doubt there is one.

Anyway, the point is that you probably won't see any performance difference, so just don't bother.
 

Brett13

Limp Gawd
Joined
Jun 23, 2003
Messages
369
The only program that I know of that does this is Folding@home. And I dont know the extent or actual ability to do this. As far as I know the Mach kernel does not support proc affinity. And even if you could the kernel would be able to do it much more efficiently than and affinity settings would. Setting the Power Tune to highest in your Power Control Pannel would do you much more good.
 

sigmend

[H]ard|Gawd
Joined
Aug 6, 2003
Messages
1,303
Ah oh well.
Just wanting to do an experiment.
Thanks for the info guys.
 

Brett13

Limp Gawd
Joined
Jun 23, 2003
Messages
369
sigmend said:
Ah oh well.
Just wanting to do an experiment.
Thanks for the info guys.

What kind of experiment?

I take it back. With a little more research, the Mach kernel supports something called processor sets. But it is only a benefit in large scale mainframes (ie 256 processors or more) where there are many threads of a process running at one time over many processors with heavy loads. This is so one processor can keep its task in the cache and not have to dump it evey time a new thread is reassigned. Dual Proc machines take a huge performance hit when manually threading. It is possible but definitely not a trivial task. Threading must be coded into the app you are using and you have to we *very* familir with Mach kernel programming There is a function: utilBindThreadToCPU() that will bind a thread to a cpu. Here is a link with more info:
http://www.simdtech.org/apps/group_public/email/altivec/msg04959.html

If you wanted to you could open up terminal and slap down:
sudo nvram boot-args="cpus=1"
and clear you pram to make good as new
courtesy of: http://developer.apple.com/qa/qa2001/qa1141.html
 
Top