简体   繁体   English

如何为多核系统找到最佳线程?

[英]How to find optimal thread for a multicore system?

I was asked in an interview how many maximum threads can be configured in a 4 core system, if you are designing a multi threaded program?.我在一次采访中被问到,如果您正在设计一个多线程程序,那么在一个 4 核系统中最多可以配置多少个线程? Searched everywhere, couldn't find a good answer for it.到处搜索,找不到好的答案。

You can have as many threads as you want, the number of CPUs(actually the number of logical processors) will decide how many of them will run in the same time.您可以拥有任意数量的线程,CPU 的数量(实际上是逻辑处理器的数量)将决定其中有多少线程将同时运行。 Maybe you should read a bit about Thread Scheduling in Java.也许您应该阅读 Java 中有关线程调度的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM