多核机器上的线程行为
Windows XP 多核机器上单个进程的线程是否并行运行?在不同的Windows版本(Windows服务器版本)上的行为是否相同
我听说只有不同进程的线程并行运行。
Does the threads of a single process run in parallel on a multi-core machine on windows XP? Is the behavior same on different windows versions (windows server editions)
I have heard that only threads of different processes run in parallel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
同一进程内的线程仍然可以在多核机器上并行运行。对于所有能够运行 .NET 的 Windows 版本来说,情况都应该如此。
你从哪里听说只有不同进程中的线程才能并行运行?将来要对这个信息源保持高度警惕(在检查他们确实是这么说的,并且你没有误解之后)。
Threads within the same process can still run in parallel on a multi-core machine. This should be the case for all editions of Windows capable of running .NET.
Where did you hear that only threads in different processes can run in parallel? Treat that source of information with a huge amount of salt in future (after checking that that's what they really said, and you didn't misunderstand).
是的,单个进程(通常)将在所有内核上运行线程。
通过在 2 个线程上运行一些繁忙的内容并查看 TaskManager,您可以轻松地看到这一点。
Yes, a single process will (normally) run threads on all cores.
You can easily see that by running something busy on 2 threads and looking at TaskManager.
是的,它们可以并行运行。当然,您不能指望有关处理器分配和/或交错的任何特定行为,因为它取决于调度程序的突发奇想以及其他正在运行的内容等......
Yes, they may run in parallel. Of course you can't count on any specific behavior wrt processor allocation and/or interleaving, since it depends on the whims of the scheduler and what else is running, etc. ...