Home

ractors

Ractors are a concurrency primitive in Ruby designed to enable parallel execution with strong memory isolation. Introduced to provide a safe path to true parallelism on multi-core systems, ractors allow Ruby code to run in separate, isolated execution contexts that do not share mutable state by default.

Each ractor runs in its own Ruby VM instance with its own heap. Objects crossing the boundary

Ractors communicate through a built-in message-passing mechanism. Programs create ractors, send messages to them, and receive

Usage considerations include performance trade-offs and library compatibility. While ractors enable parallelism beyond the Ruby GIL,

Ractors are part of Ruby’s broader approach to concurrent programming, offering a model closer to the actor

between
ractors
are
not
shared
directly;
data
is
copied
or
serialized
as
it
moves
between
ractors.
This
isolation
helps
prevent
data
races
and
eliminates
common
threading
hazards,
but
it
also
imposes
a
cost
for
inter-ractor
communication
and
for
using
non-shareable
resources.
responses.
The
typical
workflow
involves
a
ractor
processing
incoming
messages,
performing
computations,
and
yielding
results
back
to
the
sender
or
another
ractor.
Because
of
the
isolation,
most
shared
state
and
thread-local
state
are
not
directly
accessible
across
ractors.
they
require
that
data
crossing
boundaries
be
shareable
or
serializable,
and
many
standard
libraries
or
external
resources
may
not
be
fully
compatible.
There
is
also
overhead
from
inter-ractor
communication
and
from
maintaining
separate
interpreters.
paradigm.
They
complement
threads
by
providing
a
means
to
execute
code
in
parallel
without
sharing
mutable
state,
at
the
cost
of
serialization
and
potential
integration
challenges.