Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The usual maximum number that I have seen in the "running" field displayed in top(1) is the number of logical CPUs installed in the system. However, I have observed that under Ubuntu 10.04 (not checked in other versions), sometimes top(1) shows more processes running than the limit I've mentioned.

What can be causing the display of say, for example, 2 running processes in a single core system?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

The “running” field in top doesn't show the number of tasks that are simultaneously running, it shows the number of tasks that are runnable, that is, the number of tasks that are contending for CPU access.

If top could obtain all system information in a single time slice, the “running” field would be exactly the number of tasks whose status (S column) show R (again, R here is often said to mean “running”, but this really means “runnable” as above). In practice, the number may not match because top obtains information for each task one by one and some of the runnable tasks may have fallen asleep or vice versa by the time it finishes. (Some implementations of top may just count tasks with the status R to compute the “running” field; then the number will be exact.)

Note that there is always a runnable task when top gather its information, namely top itself. If you see a single runnable task, it means no other process is contending for CPU time.

share|improve this answer
    
The previous answer and this confirmed that top is showing the "runnable" threads. Yes, if there is no other process in this queue, it only shows top itself. –  efutch Aug 20 '10 at 17:30
add comment

Hyperthreading, perhaps.

Note that top's man page says:

Tasks shown as running should be more properly thought of as 'ready to run' -- their task_struct is simply represented on the Linux run-queue. Even without a true SMP machine, you may see numerous tasks in this state depending on top's delay interval and nice value.

share|improve this answer
1  
I've already discarded SMT/Hyperthreading as the architecture I'm testing does not support it. However, if it is showing the run-queue (yeah, read the man page first) then I guess that's it. –  efutch Aug 20 '10 at 17:01
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.