In the screenshot below, you can see that the OS is reporting 2925 threads.

In my own programs, I set the number of threads per core to around 1:1 and that results in the fastest overall processing. This is because once context switching starts, the performance starts to degrade.

This wouldn't really work if the number of threads being executed is in the thousands as the number of context switches would make the extra threads I use a drop in the ocean.

Is the OS reporting something different then what I'm thinking of when I'm thinking of threads?

enter image description here

enter image description here

  • You should really restart your PC sometimes. – Ave Jul 19 '16 at 21:58
  • I agree, you should. ;D – ton.yeung Jul 19 '16 at 21:59
  • Context switching will happen, regardles if you create one thread per core or not. You still have multiple processes having threads waiting for work to do. I can only assume that the performance drop you mention is when a thread gets rescheduled onto another core, something you can not (easily) control (and shouldn't try to either except for those rare circumstances) – Lieven Keersmaekers Jul 19 '16 at 22:06
  • Don't mean to go too off topic... But i5 with 1.7GHz? xD – Ab_ Jul 20 '16 at 13:34

A single process can possess multiple threads. The operating system is responsible for scheduling threads and process.

What you're seeing is summation of all threads currently running on the system. Also, context switching is a trivial operation on modern OSes with multicore CPUs.


Hefewe1zen has it right; processes may contain many threads. But not all of them are necessarily working at the same time

Many of those threads may be suspended, waiting for some sort of event to happen, in which case the CPU scheduler isn't going to bother them. In addition, the CPU scheduler is smart enough to give the lion's share of the CPU time to threads that actually need it. So you don't have to worry much about all these threads sapping your computer's performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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