Hushen Savani
Hushen Savani

Reputation: 356

Binding process to multiple processors on Sun Solaris OS

I have a server running Solaris OS. I want to bind number of processors to a certain process. I have tried following commands:

1) ps: to get process id.

bash-3.00$ ps -ef | grep java
bileng 10708 10695   3 12:20:59 pts/1       0:26 /opt/billengine/jdk1.6.0_29/bin/sparcv9/java -Dprogram.name=run.sh -Xloggc:./jb

2) psrinfo: to get the processor id.

bash-3.00$ /usr/sbin/psrinfo
0       on-line   since 11/04/2013 16:22:17
1       on-line   since 11/04/2013 16:22:18
2       on-line   since 11/04/2013 16:22:18
3       on-line   since 11/04/2013 16:22:18
4       on-line   since 11/04/2013 16:22:18
5       on-line   since 11/04/2013 16:22:18
6       on-line   since 11/04/2013 16:22:18
7       on-line   since 11/04/2013 16:22:18

3) pbind: to bind process to the processor.

I want to bind processor number 4 to 7 to a process id say 10708. Hence, I tried following command:

bash-3.00$ /usr/sbin/pbind -b 4-7 10708       
/usr/sbin/pbind: invalid processor ID 4-7

4) However, when I try binding single processor id to a process id, then it works:

bash-3.00$ /usr/sbin/pbind -b 4 10708
process id 10708: was not bound, now 4

5) But my requirement is to bind multiple processors to a single process id.

I tried exploring all the man pages and documents, but unable get the clue.

Can anyone please suggest some pointers on the same.

Thanks.

Upvotes: 3

Views: 4793

Answers (2)

Bart Smaalders
Bart Smaalders

Reputation: 21

In Solaris 11.2, you can do this with the processor_affinity(2) system call. A blog entry describing this can be found here: https://blogs.oracle.com/observatory/entry/multi_cpu_binding_mcb and there's a man page of course:

http://docs.oracle.com/cd/E36784_01/html/E36872/processor-affinity-2.html

Upvotes: 2

Dima Chubarov
Dima Chubarov

Reputation: 17179

The tool for doing this in Solaris is psrset

You create a processor set with

 psrset -c 4-7

This will return the ID of the new processor set

 created processor set ps_id

Then you can bind a process to a processor set with

 psrset -b ps_id pid

Upvotes: 3

Related Questions