简体   繁体   English

Kotlin 协程是否在应用程序所在的同一进程中运行?

[英]Does Kotlin coroutine runs in the same process where the application live?

I am new to kotlin coroutine, I need to know how kotlin coroutine manage its threading work internally.我是 kotlin 协程的新手,我需要知道 kotlin 协程如何在内部管理其线程工作。

Does it uses separate thread for each task?它是否为每个任务使用单独的线程?

Does kotlin coroutine stays in the same process where the application live? kotlin 协程是否停留在应用程序所在的同一进程中?

Does kotlin coroutine change the process during any intermediate task? kotlin 协程是否会在任何中间任务期间更改进程?

As far as I know, Coroutine uses a thread pool to run tasks.据我所知,Coroutine 使用线程池来运行任务。

So we can say as the point of Coroutine users' view each task will run on a separate thread but under the hood, it's just a thread pool.所以我们可以说,作为协程用户的观点,每个任务都将运行在一个单独的线程上,但在后台,它只是一个线程池。

And for the process yes.对于这个过程是的。 It's in the same process as the application is.它与应用程序处于相同的过程中。

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

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