05.08.2013 Views

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

52 <strong>Chapter</strong> 4 Informational Tools<br />

$ psradm -i 1<br />

$<br />

Example 4.4 Excluding a CPU from Interrupt Handling<br />

4.2.4 Controlling the Use of Processors through Processor Sets or<br />

Binding (psrset and pbind)<br />

It is possible to configure systems so that the processors are kept in discrete sets.<br />

This will partition compute resources so that particular applications run on particular<br />

sets of processors. The command to do this is psrset, and it is available only<br />

with superuser permissions. Example 4.5 illustrates the use of processor sets.<br />

Example 4.5 Example of the psrset Command<br />

# psrset -c 1<br />

created processor set 1<br />

processor 1: was not assigned, now 1<br />

# psrset<br />

user processor set 1: processor 1<br />

# psrset -e 1 sleep 1<br />

# psrset -d 1<br />

removed processor set 1<br />

The code in Example 4.5 first shows the creation of a processor set using the<br />

psrset -c option, which takes a list of processor IDs and binds those processors<br />

into a set. The command returns the id of the set that has just been created. The<br />

command psrset with no options reports the processor sets that are currently in<br />

existence, and the processors that belong to those sets. It is possible to run a particular<br />

process on a given set using the psrset -e option, which takes both the<br />

processor set to use and the command to execute on that set. Finally, the psrset<br />

-d option deletes the processor set that is specified.<br />

You must be careful when using processor sets (or any partitioning of the processor<br />

resources). Using processor sets, it is possible to introduce load imbalance,<br />

in which a set of processors is oversubscribed while another set is idle. You need to<br />

consider the allocation of processors to sets at the level of the entire machine,<br />

which is why the command requires superuser privileges.<br />

It is a good practice to check for both the number of enabled virtual processors<br />

(using psrinfo) and the existence of processor sets whenever the system’s performance<br />

is being investigated. On systems where processor sets are used regularly,<br />

or processors are often switched off, they can be a common reason for the system<br />

not providing the expected performance.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!