Taskset – to assign cpu core required for the running process.


Scenario:

When your linux system affected with performance issue and you monitor that some of the applications are running in one cpu and other cpu seems to be idle, you can map the application to another cpu by taskset command.

 

Example:

1. Identify one pid (processID)

#ps ax |grep mysql
893 ?        Ssl    0:03 /usr/sbin/mysqld
4779 pts/0    S+     0:00 grep –color=auto mysql

2. #taskset -c -p 1 893
pid 893’s current affinity list: 0
pid 893’s new affinity list: 1

This has changed from processor 0 to 1.

Note: Is this going to speed up your system or be worth doing with all tasks? Nope. It is, however, something you can try to experiment with when you’re having performance problems or having issues with a process/application causing problems with the rest of the system.

This process can also acheived in Windows server also by using the start command. for more info

c:\start /?

General syntax: c:\start /affinity 0x3 or oxc application1.exe

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: