Friday, August 27, 2010
controlling cpu usage part 5: Binding a Process to a Processor
Processor Binding is the forced locking of a process onto a particular CPU. The nominated process, or threads within a process, are only excecuted by the specified CPU. All process binding is performed through the pbind command. To bind all the threads in a process the pbind command is called with the -b option and the CPU to bind to is specified.
# psrinfo
0 on-line since 06/11/2010 12:18:49
1 on-line since 06/11/2010 12:18:51
# echo $$
16587
# pbind -b 1 $$
process id 16587: was not bound, now 1
# sh
# echo $$
18219
# pbind -q
process id 18220: 1
process id 16857: 1
process id 18219: 1
All the threads of the specified process are bound. Also, processor bindings are inherited by any new threads or processes, so any child processes are likewise bound to the same CPU.
To remove the bindings for a process the -u option to pbind can be used, the -U option removes all bindings.
# pbind -u 18219
process id 18219: was 1, now not bound
# pbind -U
# pbind -q
process id 18219: was 1, now not bound
# pbind -U
# pbind -q
Binding a process or a thread to a CPU does not prohibit that CPU from being used for other threads.
It can be used to limit the maximum amount of CPU that a process, or group of process, can use to a single CPU.
Labels:
pbind,
Performance,
Tuning
No comments:
Post a Comment