LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Games (https://www.linuxquestions.org/questions/linux-games-33/)
-   -   cpu affinity process hlds multiple (https://www.linuxquestions.org/questions/linux-games-33/cpu-affinity-process-hlds-multiple-612167/)

CosmicDebris 01-09-2008 12:42 AM

cpu affinity process hlds multiple
 
Hi all, I did a search for info on this subject to no avail. So here i am asking for your expertise on this matter.

I have a dual xeon 3Gig CPU rig on fedora core 6 and i'm trying to run two 32 slot Dayofdefeat servers with one on each CPU. Can anyone shed any light on how i would go about setting the affinity for each HLDs process.

Do i use taskset and if so how.
The reason i'm asking how is because i have just started to learn the shell and i dont want to screw anything up too badly.
I would greatly appreciate any and all help on this matter.

I'm not that knowledgeable about linux but i know HLDS like the back of my hand, So if anyone needs any help setting up servers dont hesitate to ask or PM me.

Thanks for such an informative site.

osor 01-09-2008 11:46 AM

Quote:

Originally Posted by CosmicDebris (Post 3016283)
Hi all, I did a search for info on this subject to no avail. So here i am asking for your expertise on this matter.

I presume you’ve found the manpage for taskset (type “man taskset” into a terminal).

Quote:

Originally Posted by CosmicDebris (Post 3016283)
I have a dual xeon 3Gig CPU rig on fedora core 6 and i'm trying to run two 32 slot Dayofdefeat servers with one on each CPU. Can anyone shed any light on how i would go about setting the affinity for each HLDs process.

Do i use taskset and if so how.

So you have two cpus (which I will call cpu0 and cpu1). Any process that has affinity for only cpu0 will have a mask value of 1. Any process that has affinity for only cpu1 will have a mask value of 2. Any process that has affinity for both cpus will have mask value 3. And it’s just that simple.

You can use taskset to set the affinity for an already-running process (by its PID) or set the affinity with which to launch a process (by specifying the command and its arguments).

Btw, is there any particular reason you need to alter cpu affinities? The linux scheduler does a pretty good job of using all resources efficiently. Anyway, if you want something a little more sophisticated than cpu affinity (e.g., ability to control memory mappings, etc.) you could always check out cpusets.

CosmicDebris 01-09-2008 01:55 PM

I just wanted to see if i could get as much performance out of the box that i can but i am seeing that fedora does do a pretty good job of managing resources. Thanks very much for that info, I'll add it to my memory banks and i'll post back if i see any benefit of setting the cpu affinity. ;)

[EDIT] Ok i found this just for info.

to set affinity, use the "taskset" program that comes with schedutils.

examples:
/usr/bin/taskset -p 01 9381 << pid
/usr/bin/taskset -p 02 132 << pid
/usr/bin/taskset -p 03 3049 << pid

first line tells kernel to run process #9381 (this is the pid you get in ps) on the first cpu. second line tells kernel to run process #132 on the second cpu.
third line, tells the kernel to run process #3049 on both cpus (3=1+2, bitwise)

ie. if you have a quad box and you want to run process 85 on the third cpu. /usr/bin/taskset -p 04 85 would do it. or, to run it on cpus 1 and 4, i'd use -p 09.


All times are GMT -5. The time now is 06:00 PM.