异步与多线程 - 有区别吗? [英] Asynchronous vs Multithreading - Is there a difference?

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

问题描述

异步调用是否总是创建一个新线程?两者有什么区别?

Does an asynchronous call always create a new thread? What is the difference between the two?

异步调用是否总是创建或使用新线程?

Does an asynchronous call always create or use a new thread?

维基百科说:

在计算机编程中,异步事件是独立于主程序流发生的事件.异步动作是以非阻塞方案执行的动作,允许主程序流继续处理.

In computer programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, allowing the main program flow to continue processing.

我知道异步调用可以在单线程上完成吗?这怎么可能?

I know async calls can be done on single threads? How is this possible?

推荐答案

这个问题太笼统了,无法回答.

This question is darn near too general to answer.

一般情况下,异步调用不一定会创建新线程.这是实现它的一种方式,预先存在的线程池或外部进程是其他方式.它在很大程度上取决于语言、对象模型(如果有)和运行时环境.

In the general case, an asynchronous call does not necessarily create a new thread. That's one way to implement it, with a pre-existing thread pool or external process being other ways. It depends heavily on language, object model (if any), and run time environment.

异步只是意味着调用线程不会坐下来等待响应,异步活动也不会发生在调用线程中.

Asynchronous just means the calling thread doesn't sit and wait for the response, nor does the asynchronous activity happen in the calling thread.

除此之外,您还需要更加具体.

Beyond that, you're going to need to get more specific.

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

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