在两个核心上运行一个线程

发布于 2024-08-23 05:34:45 字数 54 浏览 7 评论 0原文

当前的架构是否支持在单个系统的多个内核上运行相同的单线程?在这种情况下会涉及到什么样的问题呢?

Do current architectures provide support for running the same single thread on multiple cores of a single system? What kind of issues would be involved in such a situation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

£冰雨忧蓝° 2024-08-30 05:34:46

您基本上是在问,顺序指令是否会自动并行化?实现并行执行的方法有很多种,根据工作负载的不同,效率水平也不同。这也可能发生在不同的级别,在μarch(与你的问题相关)、ISA、操作系统等......

如果我能正确假设,并尝试回答我相信你的问题。
理论上是可行的,但尚未在商用硬件上实现。因此有许多更高级别的并行化方法。

You're basically asking, are sequential instructions automatically parallelized? There are many ways to implement parallel execution, with different levels of efficiency based on the work load. This can also happen at different levels, at the µarch (related to your question) , the ISA, the OS, and etc...

If I can assume correctly, and attempt to answer what I believe your asking.
It is theoretically possible, but hasn't been implemented on commercially available commodity hardware. Hence the many higher level methods for parallelization.

暮凉 2024-08-30 05:34:45

据我所知没有。

线程可以在不同的核心上停止并重新启动,但线程本身不能并行运行。

如果线程中有可以并行运行的代码,则应该将其分成两个线程。

Not that I know of.

A thread can be stopped an started again on a different core but a thread in and by itself can not run parallel.

If you have code in a thread that could run parallel, you should split it up in two threads.

没有你我更好 2024-08-30 05:34:45

这实际上会减慢线程的速度。每次线程切换核心时,都需要转移前一个核心的所有状态。理想情况下,线程应保留在一个核心上。

您认为在多核上运行会带来哪些优势?

This would actually slow down the thread. Every time a thread switches cores, all the state of the previous core needs to be transfered. Ideally a thread would stay on one core.

What advantages are you thinking will come from running on multiple cores?

真心难拥有 2024-08-30 05:34:45

不,我认为不存在这样的事情..

Nope, I don't think there exists such a thing..

我恋#小黄人 2024-08-30 05:34:45

它不存在,因为硬件不允许,但这是一个理论上可以通过英特尔的一些独创性消除的瓶颈。

It does not exist because the hardware doesn't permit but this is a bottleneck that could theoretically be eliminated with some ingenuity from Intel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文