Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sara Brown
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic