Jump to content

We use cookies to log you in, for ads and for analytics. OK

- - - - -

HOW TO: Set a particular process to run on a specific cpu ( SMP )

  • Please log in to reply
1 reply to this topic

#1 bluemoon



  • Members
  • Pip
  • 2 posts

Posted 07 August 2006 - 09:15 PM

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:

# apt-get install schedutils


# up2date schedutils


# 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:

# 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:

# taskset -c 3 ./server1.sh

If the 'respawning' script needs to be run in screen, you would do:

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 @ http://www.cyberciti.biz/tips/setting-proc...or-process.html

And more information about re-spawning scripts can be found @ 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.

#2 znx


    Linux-Noob GURU

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts

Posted 07 August 2006 - 09:22 PM

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 :D

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users