I have been going through the excellent Coroutine guide https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#mutual-exclusion.
One part of the Mutex has got me a little puzzled. Near the end of the Mutex section, there is a statement which says this will run slower because it is fine-grained, referring to the thread confinement. What I cannot figure out is what the context that the Mutex itself is running on? Is it a single thread context maybe? The example code shown is running the actual coroutine on the CommonPool, so the statement that it is fine-grained and will take a hit would imply that it is switching out of the CommonPool and to some other context to enter the lock/unlock, then back to the CommonPool.
Anyone have any insight? Thanks in advance.