command to show number of processors in UNIX

0

I want to check the number of processors using by a particular process in unix solaris. Which command we can use for that?

Thanks, D.

user1598776

Posted 2012-10-01T17:41:03.300

Reputation:

Answers

2

A single threaded process will only use at most one CPU and unless bounded to a processor set it can be any of them.

To know what CPUs a given process is using at a given time, you can run this command (replace pid is the process id):

prstat -p pid -n 65536 -c 0 1 | grep cpu

Remove the | grep cpu part to see all threads, including those currently sleeping.

Note that even multi-threaded processes will rarely use a lot of CPUs, if any, as they are often I/O bound, not CPU bound.

jlliagre

Posted 2012-10-01T17:41:03.300

Reputation: 12 469

Oh, I misunderstood his question I guess. I read it as "Check number of processors using a command". – favoretti – 2012-10-02T06:57:15.290

1

You can use psrinfo -v for that.

favoretti

Posted 2012-10-01T17:41:03.300

Reputation: 176

cat /proc/cpuinfo – Ivan – 2012-10-02T01:51:49.130

1/proc/cpuinfo is a Linux feature. prsinfo -v doesn't tell which process is using which cpu. – jlliagre – 2012-10-02T06:21:24.953