Tuesday, August 31, 2010

controlling cpu usage part 6: Creating and Using Processor Sets

Processor sets extend the idea of CPU bindings to a more general relationship. With processor sets some number of CPU's are collected together into a set. These CPU's are effectively fenced from the rest of the system. Normal thread cannot use these CPU's. This is different to processor bindings, where the CPU's are still available for non-bound threads.
Processor sets should only be used on legacy systems that are currently using processor sets. All new installations should use pools, as they have greater flexibility.

The following example creates an empty processor set, assigns CPU id 0 to the newly created set, then binds the current shell to the newly created set.
We then query the processor sets for the details on bound process before destroying the bindings.
Finally the processor set itself is deleted.

 # psrset -c
 created processor set 1

 # psrset -a 1 0
 processor 0: was not assigned , now 1

 # psrset -b 1 $$
 process id 18219: was not bound, now 1

 # psrset
 user processor set 1: processor 0

 # psrset -Q 1
 process id 18329: 1
 process id 18219: 1

 # psrset -U
 # psrset -Q 1
 # psrset
 user processor set 1: processor 0

 # psrset -d 1
 removed processor set 1

 # psrset


No comments:

Post a Comment