默认情况下,线程是否在多个内核上运行? [英] Do threads by default run on more than one core?

查看:233
本文介绍了默认情况下,线程是否在多个内核上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在多核处理器中,Windows应用程序运行许多线程. 默认情况下的线程是否在多个内核上运行? 我的意思是每个线程都可以在单个内核上运行.

In multi-core processors, and windows application runs many threads. do the threads by default run on more than one core ? I mean every thread might run on individual core.

如果我的应用程序运行许多线程,则所有这些线程将在一个进程上运行.

If my application runs many threads, all these threads will run on one process.

没有并行编程..

该流程能够在许多核心上运行吗?

Is the process able to devide and run on many core ?

我的应用程序是否受益于多核处理?

Does my application get benifit of multi-core processing ?

推荐答案

(您的问题还不太清楚.我希望我已经回答了您的问题,但是是否可以澄清有帮助的问题.)

(Your question is fairly unclear. I hope I've answered what you were asking, but if you can clarify the question that would help.)

取决于调度线程的操作系统.就缓存一致性等而言,如果可能的话,将线程保持在同一内核上具有优势.但强制将其保留在同一内核上通常过于严格.

It's up to the OS where a thread is scheduled. There are advantages to keeping a thread on the same core if possible, in terms of cache coherency etc — but forcing it to stay on the same core is usually overly restrictive.

简而言之:是的,线程可以在不同的内核上运行.当然,不是同一时间-这只是执行的一个线程—但是它可以在T 0 的时间在C 0 内核上执行,然后在T 1 1 内核上执行>.

In short: yes, a thread can run on different cores. Not at the same time, of course - it's only one thread of execution — but it could execute on core C0 at time T0, and then on core C1 at time T1.

您谈论的是一个运行许多线程的应用程序,但是没有并行编程"—这是一个矛盾.如果您使用多个线程,则 使用并行编程,并且默认情况下,这些线程可以在多个内核上运行.如果您仅使用一个线程,那么拥有多个内核将不会有任何好处—当然,除了其他进程可以使用其他内核这一事实之外.

You talk about an application running many threads, but "without parallel programming" — that's a contradiction in terms. If you're using many threads, you are using parallel programming, and by default those threads can run on multiple cores. If you're only using one thread, then you won't get any benefit from having multiple cores — other than the fact that other processes can use the other cores, of course.

这篇关于默认情况下,线程是否在多个内核上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆