Cpuset Management Utility

From RTwiki
(Difference between revisions)
Jump to: navigation, search
(27 intermediate revisions by 11 users not shown)
Line 9: Line 9:
 
{{HINT|Binary packages for many distributions are available via the [http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/ openSUSE Build Service here.]}}
 
{{HINT|Binary packages for many distributions are available via the [http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/ openSUSE Build Service here.]}}
  
{{NOTE|An in-depth tutorial for both basic shielding and advanced cpuset manipulation using [[Cpuset management utility/tutorial | cset can be found here.]]}}
+
{{NOTE|An in-depth tutorial for both basic shielding and advanced cpuset manipulation using [[Cpuset Management Utility/tutorial | cset can be found here.]]}}
  
 
==A Quick Tour of Cpuset==
 
==A Quick Tour of Cpuset==
Line 15: Line 15:
 
The cpuset utility (called cset after install) includes three commands: "set", which is used for creating and managing cpusets; "proc", which is used to manage processes in those sets; and "shield", which is a ''supercommand'' that implements a basic CPU shielding methodology.
 
The cpuset utility (called cset after install) includes three commands: "set", which is used for creating and managing cpusets; "proc", which is used to manage processes in those sets; and "shield", which is a ''supercommand'' that implements a basic CPU shielding methodology.
  
Here is a quick reference on the cset command and how to:
+
Here is a quick reference on the cset command:
  
For an in-depth [[Cpuset management utilty/shield_writeup | <u>write up of the shield supercommand</u>]]:
+
For an in-depth [[Cpuset Management Utilty/shield_writeup | <u>write up of the shield supercommand</u>]]:
 
     # cset help shield
 
     # cset help shield
 
To see the options for the shield supercommand:
 
To see the options for the shield supercommand:
 
     # cset shield --help
 
     # cset shield --help
  
For an in-depth [[Cpuset management utility/set_writeup | <u>write up of the set subcommand</u>]] (cpuset management):
+
For an in-depth [[Cpuset Management Utility/set_writeup | <u>write up of the set subcommand</u>]] (cpuset management):
 
     # cset help set
 
     # cset help set
 
To see the options for the set command:
 
To see the options for the set command:
 
     # cset set --help
 
     # cset set --help
  
For an in-depth [[Cpuset management utilty/proc_writeup | <u>write up of the proc subcommand</u>]] (process management):
+
For an in-depth [[Cpuset Management Utilty/proc_writeup | <u>write up of the proc subcommand</u>]] (process management):
 
     # cset help proc
 
     # cset help proc
 
To see the options for the proc command:
 
To see the options for the proc command:
Line 33: Line 33:
  
 
===Using cpuset to implement shielding===
 
===Using cpuset to implement shielding===
See [[Cpuset management utility/tutorial | <u>the cset tutorial</u>]] for an in-depth discussion.  
+
See [[Cpuset Management Utility/tutorial | <u>the cset tutorial</u>]] for an in-depth discussion.  
  
 
To create a shield, for example on a 4-way machine, shielding cpus 1,2,3 and leaving cpu 0 for system tasks (unshielded):
 
To create a shield, for example on a 4-way machine, shielding cpus 1,2,3 and leaving cpu 0 for system tasks (unshielded):
Line 57: Line 57:
 
     # cset shield -e bash
 
     # cset shield -e bash
 
     $ run_my_code
 
     $ run_my_code
 
[http://www.thequitsmokingplace.com/smoke-deter-review Smoke Deter Review]
 
[http://www.gunloophole.com Alisia Healy]
 

Revision as of 19:44, 6 September 2011

Current Version: 1.5.3

Cpuset is a GPL v2 Python application to make using the cpusets facilities in the Linux kernel easier. The actual included command is called cset and it allows manipulation of cpusets on the system and provides higher level functions such as implementation and control of a basic cpu shielding setup. Cpuset is developed at Novell as part of the SLERT 10 SP2, SP3, and SLERT 11 as well as the SLES 11 releases.

Note: you need to be root to perform most of the functions that cpuset implements.

The cpuset project is hosted on a Google code hosting site. You will find there the public mercurial source repository and a public bug tracking facility. The author of the cpuset tool is Alex Tsariounov <alext at novell dot com>.

Hint:
Binary packages for many distributions are available via the openSUSE Build Service here.
NOTE!
An in-depth tutorial for both basic shielding and advanced cpuset manipulation using cset can be found here.

A Quick Tour of Cpuset

The cpuset utility (called cset after install) includes three commands: "set", which is used for creating and managing cpusets; "proc", which is used to manage processes in those sets; and "shield", which is a supercommand that implements a basic CPU shielding methodology.

Here is a quick reference on the cset command:

For an in-depth write up of the shield supercommand:

    # cset help shield

To see the options for the shield supercommand:

    # cset shield --help

For an in-depth write up of the set subcommand (cpuset management):

    # cset help set

To see the options for the set command:

    # cset set --help

For an in-depth write up of the proc subcommand (process management):

    # cset help proc

To see the options for the proc command:

    # cset proc --help

Using cpuset to implement shielding

See the cset tutorial for an in-depth discussion.

To create a shield, for example on a 4-way machine, shielding cpus 1,2,3 and leaving cpu 0 for system tasks (unshielded):

    # cset shield --cpu 1-3

To move kernel threads from the root cpuset (all processors) to the system processors (unshielded cpus):

    # cset shield --kthread on

To run a program in the shield, ie. on the shielded processors:

    # cset shield --exec /opt/path/bin/my_code

To move a set of already running processes and threads (tasks) into the shield:

    # cset shield --shield 2242,2244,3000-3100

To move a set of already running tasks in the shield out of the shield:

    # cset shield --unshield 3000-3100

To destroy the shield and return all processes to the root cpuset (ie. all cpus):

    # cset shield --reset

Note that all of the above long options also have corresponding short option. A nice way to experiment with shielding is to first set up a shield and then run a shell on it. Since the cpuset property is inherited for children, all processes run in that shell will be in the shield, for example:

    # cset shield -c 1-3
    # cset shield -e bash
    $ run_my_code
Personal tools