CPU和线程之间有任何关系吗? [英] Is there any relation between CPU and threads?

查看:110
本文介绍了CPU和线程之间有任何关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有,那是什么关系?

If there is, what is the relation?

推荐答案

将CPU视为个人,将线程视为个人必须执行的单个任务.

Think of a CPU as a person, and a Thread as a single task that person has to perform.

例如,如果一个人试图洗碗,准备早餐,给孩子穿衣服,并确保猫不吃狗粮,那么该人必须在工作之间快速地来回切换以便似乎可以同时在所有任务上取得一些进展.

For instance, if one person tries to wash the dishes, prepare breakfast, put clothes on the children, and make sure the cat doesn't eat the dog food, that person has to switch back and forth between tasks rapidly, in order to have some progress on all tasks seemingly at the same time.

但是那个人一次只能做一件事.

But that person can only do one thing at a time.

重访2013 :请注意,上述情况不一定正确.首先,单个处理器"现在具有多个内核,每个内核都可以使用管道同时执行多项操作,而不能执行.这比一个CPU一次只能做一件事"要复杂得多.

Revisit 2013: Note that the above is not necessarily true. First of all, a single "processor" now has multiple cores, each capable of doing multiple things at the same time with pipelines and what not. It's a far more complex world than just "a single CPU can do only one thing at a time".

这篇关于CPU和线程之间有任何关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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