本文介绍了线程几乎没有开销.流程有相当大的开销.这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读Thread和Process之间的差异时,我碰到了此语句.请解释.

I came across this statement while reading difference between Thread and Process. Please explain.

推荐答案

我想说的是,创建一个新线程并在线程之间进行通信是相当有效的/廉价的,而创建一个新进程并在进程之间进行通信则是相当低效的/昂贵.

I think it's trying to say that creating a new thread and communicating between threads is reasonably efficient/cheap, whereas creating a new process and communicating between processes is reasonably inefficient/expensive.

虽然有点笼统,但不同操作系统之间的成本差异很大.与大多数Unix实现(试图使进程创建便宜)相比,该声明在Windows上更真实",即使在Windows上,说线程几乎没有开销"也是不正确的.创建新线程仍然不是一件容易的事.

It's a bit of a blanket statement though - the costs vary significantly between different operating systems. The statement is "more true" on Windows than on most implementations of Unix (which try to make process creation cheap) and even on Windows it's untrue to say that threads have "almost no overhead". Creating a new thread is still far from a trivial operation.

这篇关于线程几乎没有开销.流程有相当大的开销.这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 15:51