线程与并行性有何不同? [英] Threading vs Parallelism, how do they differ?

查看:62
本文介绍了线程与并行性有何不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

线程化和并行性有什么区别?

What is the difference between threading and parallelism?

哪个人比另一个人有优势?

Which one has advantage over the other?

推荐答案

Daniel Moth (a former coworker of mine)- Threading/Concurrency vs Parallelism article explains it all.

引用:

最终要充分利用我们软件中的多个内核 必须使用线程.因此,一些开发人员陷入了 将多线程等同于并行性的陷阱.那不是 准确...您可以在单核计算机上使用多线程,但是 您只能在多核计算机上具有并行性

To take advantage of multiple cores from our software, ultimately threads have to be used. Because of this fact, some developers fall in the trap of equating multithreading to parallelism. That is not accurate...You can have multithreading on a single core machine, but you can only have parallelism on a multi core machine

快速测试:如果在单核计算机上使用线程,并且对您的情况而言非常合适,那么您就不是在进行并行处理",而是在进行多线程处理.

The quick test: If on a single core machine you are using threads and it makes perfect sense for your scenario, then you are not "doing parallelism", you are just doing multithreading.

这篇关于线程与并行性有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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