kotlinx.coroutines icon indicating copy to clipboard operation
kotlinx.coroutines copied to clipboard

Fix misleading documentation comment for Dispatchers.IO

Open kaseken opened this issue 5 months ago • 0 comments
trafficstars

Problem

The documentation for Dispatchers.IO appears to be misleading.

Specifically, it suggests that the kotlinx.coroutines.io.parallelism system property limits the number of threads, when in fact:

  • The kotlinx.coroutines.io.parallelism property controls the parallelism limit, not the maximum thread count.
  • The actual thread pool backing Dispatchers.IO can grow up to MAX_POOL_SIZE, which defaults to CoroutineScheduler.MAX_SUPPORTED_POOL_SIZE (2^21 - 2 = 2,097,150 threads).

Proposal

Update the comment to clarify that kotlinx.coroutines.io.parallelism controls parallelism (i.e., the number of concurrently scheduled tasks), not the actual number of threads used by the underlying thread pool.

kaseken avatar Jun 14 '25 06:06 kaseken