More on Dispatchers

Learn about some more dispatcher types.

We need to consider the shared state problem for all dispatchers using multiple threads. Notice that in the example below, 10,000 coroutines are increasing i by 1. So, its value should be 10,000, but it’s a smaller number. This is a result of a shared state (i property) modification on multiple threads simultaneously.

Get hands-on with 1400+ tech skills courses.