In Android (and other UI frameworks as well), the UI/main thread operates an "event loop." It does this by waiting for tasks to be planned for it, having a queue of them, and carrying them out in order. For instance, an internal onClick action is planned to be executed on the main thread when you click a button. However, the user is also permitted to manually schedule their jobs using methods like runOnUiThread() or getMainLooper ().
Dispatchers.
The main thread can be scheduled with just one more method, the main. Coroutines do not automatically assume complete control over the main thread or magically introduce new content. The cooperative main thread enables task and coroutine scheduling.
Additionally, you questioned in the comments how it was feasible for both log statements to be executed concurrently on the same thread. They do not operate simultaneously. Only log("A") is added to the queue by onCreate() and scheduled to run later. When onCreate() completes, log("B") is then called, and only then can the main thread begin executing the log("A") block. In other words, although not in top-to-bottom order, this is sequential.