aspose file tools*
The moose likes Threads and Synchronization and the fly likes How many application threads can concurrently run on my machine? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "How many application threads can concurrently run on my machine?" Watch "How many application threads can concurrently run on my machine?" New topic
Author

How many application threads can concurrently run on my machine?

Chan Ag
Bartender

Joined: Sep 06, 2012
Posts: 1049
    
  15
Greetings,

Could you tell me how many threads can concurrently run on my machine. Following are some of the details I have, based on what google suggested.

1. When I go to device manager and click on Processors tab, I see 8 tabs. Screenshot is attached. So do I have an 8-core processor.
2. Also when I click on task manager-performance tab, I see 8 CPU history boxes in the CPU usage section. Screenshot attached.

So can 8 threads concurrently run on my computer?

Thanks,
Chan.





[Thumbnail for DM.png]

[Thumbnail for PerformanceTab.png]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42594
    
  65
That depends on your definition of "concurrently" and what kinds of threads you're talking about. Given the deep pipelines and multiple functional units of modern CPUs, an 8-core CPU will have many more than 8 instructions being worked on in parallel, probably closer to 80.

On the Java side, you can probably start hundreds (maybe thousands) of threads and have them all make progress without putting any one explicitly to sleep - the JVM will do that on its own. But a thread context switch takes many instructions to execute, both for OS-level threads and for Java threads, so the overhead of thread management will make this inefficient sooner rather than later.

Also keep in mind that the OS needs CPU time for its dozens of processes, and the JVM needs time for its own threads, so you will never get all 8 cores working on your application code.


Ping & DNS - my free Android networking tools app
Chan Ag
Bartender

Joined: Sep 06, 2012
Posts: 1049
    
  15
Thanks, Ulf.
 
 
subject: How many application threads can concurrently run on my machine?