Home

DispatchersDefault

DispatchersDefault, commonly referred to in code as Dispatchers.Default, is the default CoroutineDispatcher provided by the Kotlin Coroutines library for CPU‑bound work. It represents a shared pool of background threads separate from the main thread and is used automatically when no dispatcher is specified for a coroutine.

On the JVM, DispatchersDefault is backed by a thread pool sized to efficiently utilize available CPU cores.

Usage is straightforward for CPU‑intensive tasks: launch a coroutine with a context of Dispatchers.Default or wrap

DispatchersDefault is distinct from other dispatchers in the Kotlin Coroutines family. Dispatchers.IO provides a separate pool

Configuration and caveats: The parallelism of the Default dispatcher can be overridden via the system property

The
pool
uses
a
work-stealing
scheduler
to
balance
CPU‑bound
tasks
across
threads
and
is
initialized
lazily
when
first
used.
The
underlying
thread
count
is
designed
to
scale
with
hardware
while
avoiding
excessive
thread
creation.
blocking
computations
with
withContext(Dispatchers.Default).
If
you
do
not
specify
a
dispatcher,
coroutines
are
scheduled
on
DispatchersDefault
by
default.
optimized
for
I/O-bound
operations
with
a
larger,
unbounded
thread
pool,
while
Dispatchers.Main
targets
the
main
thread
in
UI
applications.
In
general,
Dispatchers.Default
should
not
be
used
for
long‑running
or
blocking
I/O
tasks.
kotlinx.coroutines.default.parallelism.
Blocking
calls
inside
this
pool
should
be
avoided;
for
blocking
or
long‑running
I/O,
Dispatchers.IO
is
preferred.
Across
platforms
(JVM,
Android,
Native,
JS),
implementation
details
and
threading
semantics
may
vary,
but
the
core
purpose—efficient
CPU-bound
task
execution—remains
consistent.