Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
howtos:hardware:processor_affinity [2013/01/13 18:10 (UTC)]
hazel [Taskset]
howtos:hardware:processor_affinity [2013/01/13 18:12 (UTC)] (current)
hazel [Taskset]
Line 28: Line 28:
  
  
-Slackware has a tool for setting the processor affinity for a certain task or process. It is called "''​taskset''"​ and is part of the ''​util-linux''​ package. Run "''​man 1 taskset''"​ if you want to know more about its purpose and commandline ​syntax.+Slackware has a tool for setting the processor affinity for a certain task or process. It is called "''​taskset''"​ and is part of the ''​util-linux''​ package. Run "''​man 1 taskset''"​ if you want to know more about its purpose and command line syntax.
  
 <​note>​The ''​taskset''​ command is used to set or retrieve the CPU affinity of a running process given its PID, or to launch a new COMMAND with a given CPU affinity.</​note>​ <​note>​The ''​taskset''​ command is used to set or retrieve the CPU affinity of a running process given its PID, or to launch a new COMMAND with a given CPU affinity.</​note>​
Line 38: Line 38:
 0xffffffff means all processors (#0 through #31) 0xffffffff means all processors (#0 through #31)
 </​code>​ </​code>​
-Luckily you can use human-readable numbers instead of a bitmask if you add the "​-c" ​commandline ​parameter.+Luckily you can use human-readable numbers instead of a bitmask if you add the "​-c" ​command line parameter.
  
 Examples: Examples:
Line 47: Line 47:
 </​code>​ Confused by hexadecimal numbers? Then use the human-readable version: <​code>​ </​code>​ Confused by hexadecimal numbers? Then use the human-readable version: <​code>​
 $ taskset -cp 1 1337 $ taskset -cp 1 1337
-</​code>​ You may notice the strange order of commandline ​options and arguments; first come all the options and then follow the argument values in pre-defined order... ''​man taskset(1)''​ is your friend.+</​code>​ You may notice the strange order of command line options and arguments; first come all the options and then follow the argument values in pre-defined order... ''​man taskset(1)''​ is your friend.
   * To start a new process with a fixed CPU affinity, you omit the "​-p"​ switch and append a command line, like this real-world example of starting a Minecraft server: <​code>​   * To start a new process with a fixed CPU affinity, you omit the "​-p"​ switch and append a command line, like this real-world example of starting a Minecraft server: <​code>​
 $ taskset -c 3 java -Xmx1024M -jar minecraft_server.jar nogui $ taskset -c 3 java -Xmx1024M -jar minecraft_server.jar nogui

In Other Languages
QR Code
QR Code howtos:hardware:processor_affinity (generated for current page)