协程" A&QUOT之间的差异;和一个与QUOT;丝线QUOT ;? [英] Difference between a "coroutine" and a "thread"?

查看:157
本文介绍了协程" A&QUOT之间的差异;和一个与QUOT;丝线QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是一个协程和一个线程

What are the differences between a "coroutine" and a "thread"?

推荐答案

是协同程序顺序处理的一种形式:只有一个在任何给定时间(就像子程序AKA程序正在执行AKA功能 - 他们只是通过每个之间的接力棒其他更流畅;-)。

Coroutines are a form of sequential processing: only one is executing at any given time (just like subroutines AKA procedures AKA functions -- they just pass the baton among each other more fluidly;-).

线程是(至少在概念上)并行处理的形式:多个线程可在任何给定的时间被执行。 (传统上,在单CPU,单核的机器,这是并发模拟从OS一些帮助 - 现在,既然有这么多机器多CPU和/或多核,线程会的事实上的被simulaneously执行,不只是概念; - )

Threads are (at least conceptually) a form of concurrent processing: multiple threads may be executing at any given time. (Traditionally, on single-CPU, single-core machines, that concurrency was simulated with some help from the OS -- nowadays, since so many machines are multi-CPU and/or multi-core, threads will de facto be executing simulaneously, not just "conceptually";-).

这篇关于协程" A&QUOT之间的差异;和一个与QUOT;丝线QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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