Skip to content

Strategies for using the dispatchers

Devrath edited this page Jan 13, 2024 · 3 revisions

IT-Strategy-Banner

Executing code on Main-Thread

  • To execute code on the main thread we just use Dispatchers.Main.immediate

Executing code on Background-Thread

  • Dispatchers.Default
    • Used for intensive computation tasks.
    • Number of threads used are max(2,no_of_cpu_cores)
  • Dispatchers.IO
    • Used for IO operations(mostly waiting tasks)
    • Number of threads used are max(64,no_of_cpu_cores)
    • The maximum of threads can be further increased by altering system.properties
Clone this wiki locally