By default coroutines always run on main thread in time shared manner. However, if you really want to force a coroutine to run on separate thread, you can do that. In this video we try to understand what it means to run a coroutine in a multithreaded environment. We also look the the code to understand how it is done. We use withContext to achieve this. There are four types of dispatchers - IO, Default, Non-confined and Main. We also briefly discuss about Coroutine scopes as well in this video. These determine in which thread the coroutine will be run by the Kotlin run time environment.
Follow me on Twitter: / anilvdeshpande