English 中文(简体)
CPU 密集阅读智慧
原标题:CPU-intensive thread wisdom

我想用一个批量说,在机器上,有20个CPU密集的 comp子(实际上是长时间的nes门)。

Each of these 20 jobs doesn t share data with the other 19.

如果机器有N芯,那么我是否应当把N-1的这些工作推向次要位置? 还是N? 或者,我是否只是发射所有20个,窗户如何安排它们?

最佳回答

不幸的是,没有简单的答案。 了解情况的唯一途径是执行和介绍你的申请。

Typically, for maximum throughput, if the jobs are pure CPU, you d want one per core. Depending on the type of work, this would include one per hyperthread code or just one per "true physical core". (If the work is identical for all 20 jobs, then hyperthreading often slows down the overall work...)

如果工作有 任何 非《万国邮联》职能方面(如阅读档案、等待任何事情等),则“......” ;1 每一核心工作项目往往更好。 在许多情况下,情况会有所改善。

问题回答

一般来说,如果你是交换数据,而不是阻挡国际交易日志,而且使用国邮联的批号,而使用国邮联的所有(例如N'threads)的箱子(可能还有几处)则可能是最理想的。

最好的选择或许是使其具有可图谋,并了解情况。

You should use a thread pool of some sort, so it s (reasonably) easy to tune the number of threads without affecting the structure of the program.

一旦您提出,它就是一个比较简单的测试问题,以便找到与现有加工商数量相对应的适当数量。 经验是,即使他们看上去这种事情就纯粹是万国邮联的束缚,你也会因为read子的数量而提高效率,但只有检验才能确定。





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签