进程和线程有什么区别? [英] What is the difference between a process and a thread?

查看:131
本文介绍了进程和线程有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过程和线程之间的技术差异是什么?

What is the technical difference between a process and a thread?

我感觉到一个像进程被过度使用的单词,还有硬件和软件线程。如 Erlang 等语言的轻量级流程如何?有没有一个明确的理由来使用一个术语?

I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes in languages like Erlang? Is there a definitive reason to use one term over the other?

推荐答案

进程和线程都是独立的执行序列。典型的区别是线程(相同进程)在共享内存空间中运行,而进程在单独的内存空间中运行。

Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.

我不知道什么硬件vs软件线程可能是指的。线程是一个操作环境功能,而不是CPU功能(尽管CPU通常具有使线程有效的操作)。

I'm not sure what "hardware" vs "software" threads you might be referring to. Threads are an operating environment feature, rather than a CPU feature (though the CPU typically has operations that make threads efficient).

Erlang使用术语进程,因为它不暴露共享内存多重编程模型。调用他们的线程将意味着他们有共享内存。

Erlang uses the term "process" because it does not expose a shared-memory multiprogramming model. Calling them "threads" would imply that they have shared memory.

这篇关于进程和线程有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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