Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple instances of a database running on a Solaris system. I'd like to prove that each database process is being handled by a different CPU. Essentially, I want to be able to do something like a ps -ef | grep <process_name> to get the PIDs and then run another command (if required) to identify the CPU...

Is prstat able to do this?

I'm making an assumption that as each database instance is started each one uses a different CPU. I'm not sure if I'm understanding this correctly...

The reason I want to do this is because Sun hardware has slow CPU's, but lots of them. Therefore, to get the best performance out of it, I need to try and spread the load among CPU's...


share|improve this question

migrated from Jan 6 '11 at 15:12

This question came from our site for computer enthusiasts and power users.

Use ps -P or ps -o psr (in addition to other options) to show which processor a process is assigned to.

share|improve this answer

By default, processes aren't bound to specific CPUs.

You can bind them either to a single one with the pbind command (non exclusive binding) or with a group of CPUs with the psrset one (exclusive binding).

Use pbind -Q and psrset -q to figure out if it is the case.

share|improve this answer

This post says:

The top(1) command will show what processes are running on what processor.

share|improve this answer

Prstat does show the CPU in the STATE column. It would be like cpu0, cpu1, etc. That information is very dynamic and processes will jump around between CPUs when they're ready to run. Most of the time they probably won't be on a CPU but waiting for I/O. I'm not sure what you're trying to prove. The OS will use all the CPUs as needed.

share|improve this answer
unless asked to do otherwise. – jlliagre Jan 6 '11 at 22:49
That wasn't mentioned in the question so I assumed standard configuration. – JOTN Jan 8 '11 at 21:45

So, it sounds like it's all dynamic. Basically, what I want to prove is that the system is spreading load among the available CPU's. I had made an assumption that when the process starts it's assigned to a CPU and sticks until killed. From what has been said, it sounds like it will be spread among CPU's by the kernel? Therefore, load balancing within the system can be assumed

The reason for the question, Sun CPU's are slow. We've had a scenario where hardware was replaced because, although it had 32 CPU's, only one was being used, so it was replaced with bigger hardware just so clock speed could be increased...

We don't have this problem with Intel and Linux, because the CPU's are just faster...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.