문제

If I have 8 asynchronous functions to execute and 4 cores in my CPU, What is better (more speedy and correct)?

  1. Start 4 threads and when finish a thread, start another thread, etc.
  2. Start 8 threads

Language aren't important.

도움이 되었습니까?

해결책

The answer is: It depends.

It depends on the workload. If threads are I/O bound, you can benefit by starting all 8 threads. If they're highly CPU bound, then it makes less sense.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top