HOW TO: Set a particular process to run on a specific cpu ( SMP ) - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html) +--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-59.html) +--- Thread: HOW TO: Set a particular process to run on a specific cpu ( SMP ) (/thread-1860.html) |
HOW TO: Set a particular process to run on a specific cpu ( SMP ) - bluemoon - 2006-08-07 OK, Well znx needs to be thanked once again for this. Where this can be used for example: If you are running 4 gaming servers assuming you are using Dual Xeon processors with HT ( classed as 4 cpu's in linux) Server 1 uses 60% CPU Usage Server 2 Uses 60% CPU Usage Server 3 Uses 20% CPU Usage Server 4 Uses 20% CPU Usage Rather than letting the distro automtically assign CPU's it is sometimes better for you to do it manually. In this instance it would make server to have Server 1 using CPU0 Server 2 using CPU1 Server 3 + 4 using CPU2 Leaving you with a spare CPU. Example of how to install this in Debian / Redhat / Other: Code: # apt-get install schedutils Redhat Code: # up2date schedutils Other Code: # rpm -ivh schedutils* If you have a particular process running and it will retain the same PID throughout then you can do the following command: Code: # taskset -c 1 -p 13545 '-c 1- = Which cpu you wish the process to run on. In my example this can be set to Either ( CPU0, CPU1, CPU 2, CPU3 ) '-p 12345- Is the process, if the process does not retain the same PID then you need to do the following: Code: # taskset -c 3 ./server1.sh If the 'respawning' script needs to be run in screen, you would do: Code: screen -m -d -s -- taskset -c 3 ./server1.sh The parent and child, no matter how many times new children (therefore new PIDs) it will still run on CPU3 ( -c3 ) More information on this can be found @ [/url]http://www.cyberciti.biz/tips/setting-proc...or-process.html And more information about re-spawning scripts can be found @ [url=<___base_url___>/index.php?showtopic=1746][/url][url=<___base_url___>/index.php?showtopic=1746]https://www.linux-noob.com/forums/index.php?showtopic=1746 I hope this helps. Sorry if some of the lingo is incorrect. I tried my best, im a linux noob :) Thanks to znx again. HOW TO: Set a particular process to run on a specific cpu ( SMP ) - znx - 2006-08-07 This is awesome bluemoon. When we first discussed this I didn't think there was a utility capable of doing it. But you kept plugging away and researching! It allows you more than just the ability to separate across CPUs. It will improve the frame rates on game servers! Woot :) |