简体   繁体   English

至少,运行一个异步任务需要多少线程?

[英]At least, how many threads are needed to run an async task?

This was an interview question asked by a senior manager.这是一位高级经理问的面试问题。

At least, how many threads are needed to run an async task?至少,运行一个异步任务需要多少线程?

I said that at least one thread is needed, but I'm not sure if I said it right or not.我说至少需要一个线程,但我不确定我说的对不对。

Any ideas?有任何想法吗?

From Microsoft :来自微软

Async methods don't require multithreading because an async method doesn't run on its own thread.异步方法不需要多线程,因为异步方法不在其自己的线程上运行。 The method runs on the current synchronization context and uses time on the thread only when the method is active.该方法在当前同步上下文上运行,并且仅在该方法处于活动状态时才使用线程上的时间。

You gave the correct answer.你给出了正确的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM