1

This question is regarding Multithreading in Java.

Multithreading is for the maximum utilisation of cpu. According to what I read, only one thread can be executed at a time. I believe that it it true for single processor system. Number of threads that can be executed simultaneously depends on what factors??

For Instance, If I am using 4 core processor, how many threads can be run concurrently??

Thanks in Advance.

user3725074
  • 103
  • 1
  • 3
  • possible duplicate of [Maximum number of threads than can run concurrently in java on a CPU](http://stackoverflow.com/questions/21650083/maximum-number-of-threads-than-can-run-concurrently-in-java-on-a-cpu) – tucuxi Apr 22 '15 at 10:45
  • _According to what I read... I believe that it it true for single processor_ Your belief is correct: What you read is out-of-date. It was true when a computer had only one CPU, but today, even a smart phone can have more than one CPU, and a mainframe can have more than a hundred CPUs. The max number of concurrent threads is equal to the number of CPUs. (Note: a _hyperthreaded_ core can count as more than one virtual CPU). – Solomon Slow Apr 22 '15 at 13:43

1 Answers1

1

For a 4-core processor 4 threads, or 8 if there's HyperThreading in the processor.

HyperThreading allows a core that's not running at 100% capacity to run 2 threads on a single core.

Kayaman
  • 72,141
  • 5
  • 83
  • 121