[CentOS] command to see if a process is being spread among multiple cpus

Wed Apr 4 14:17:50 UTC 2007
Matthew Miller <mattdm at mattdm.org>

On Wed, Apr 04, 2007 at 08:06:13AM -0300, Antonio da Silva Martins Junior wrote:
>   But, _a_ process can't spread on multiple CPUs... to do this the
> application need to be specificaly designed to do so. A way to do this is
> using multi-threads, another one is forking multi-instances. But, with
> only one instance running an application will use only one CPU.

A multi-threaded application is one process. I'm not sure how to display
them separately in top -- in 'ps', you use the 'm' flag, like `ps auxm`, or
else -L, like `ps -eLf`.

I'm not sure how to show which CPU is being used by a given thread at any
given moment. However, I don't think that's really necessary to answer to
original question, because we can usually trust Linux to do the right thing
here. If your program is multithreaded, it will be spread among multiple
CPUs as appropriate. So, just use the above command and count the threads.

-- 
Matthew Miller           mattdm at mattdm.org          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>