File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes different between core and threads and maximum threads can be use in program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "different between core and threads and maximum threads can be use in program" Watch "different between core and threads and maximum threads can be use in program" New topic
Author

different between core and threads and maximum threads can be use in program

Sara Brown
Ranch Hand

Joined: Feb 22, 2012
Posts: 55
Assume processor core i5 have 2 cores and 4 threads.

my questions:
1- if we make a program using more than available threads in the processor (more than 4 threads), what will happen to the program? Is the program can still be run faster than the sequential program?
2- 2 cores, 4 threads. does that means each core can run 4 threads or each core run 2 threads?

please help. im not good enough with the core and threads.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4174
    
  21

Wethher an app that uses more threads than those available to the CPU runs faster than one that doesn't depends a lot on the application and what it does. If the application is processor intensive - if it has a lot of calculations and uses a lot of CPU cycles, then the chances of it running faster with more threads is low. If there are a lot of gaps where the thread has to wait for I/O or for some event, then it could run faster with more threads.


For the second question: that would be a question for Intel documentation, but no, the i5 has 2 cores, each of which can run 2 threads, for a total of 4.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: different between core and threads and maximum threads can be use in program