How Many Threads Can I Run Smoothly on My Machine with 64 Cores?
Asked by
CleverPineapple21
I have a machine with 64 CPU cores and 256 GB of RAM, and I'm trying to figure out the optimal number of threads I can run in a program for everything to operate smoothly. I'm looking for guidelines or documentation that can help clarify this.
Answers
Generally, your hardware allows for at least 64 threads to run in parallel. If your program involves a lot of I/O waiting, you might actually benefit from having more threads than cores to keep things moving while some threads are stalled. Itโs all about maximizing throughput!
Reply to this answer
Also, consider your CPU's capabilitiesโdoes it have hyperthreading? The specific workload you're running matters too. Keep in mind that operating system threads, CPU threads, and virtual threads are not the same thing.
Reply to this answer
It really depends on your workload! You could have a ton of threadsโlike 100Kโjust waiting for data, and your CPU usage might be zero. But if you're running complex math operations, those threads could max out your CPU usage. It's all about what your tasks are doing!
Reply to this answer
The ability to separate tasks is key here. If you have a million operations but each one depends on the previous one, you're not going to benefit from multiple threads, as you'd barely be able to use even two.
Reply to this answer
Add your answer
Answers are reviewed before publication.
BrainyBeetle34: Yeah, the classic rule of thumb is one thread per core, but really, it all depends on what those threads are up to.