Ruby Runtime

From RubySpec

Jump to: navigation, search

This set of pages details runtime characteristics not specific to any one Ruby implementation.

Threading

All Ruby runtimes support the concept of multithreading; that is, they allow multiple lines of execution to be executed concurrently (limitations of the implementation or the underlying platform notwithstanding). Multithreading is used heavily throughout the standard libraries and is frequently used for short-lived asynchronous or parallel jobs. One such example of heavy threading use is in the timeout library.

Each Ruby implementation has the option of implementing threading in whatever way is appropriate for the target platform. The standard Ruby, implemented in C, implements green threads, where all threads spawned are serviced by a single OS-level thread. JRuby implements threads using Java's own threading support, which on most platforms provides a 1:1 mapping between a Java thread and an OS-level thread. This means that Ruby's threads are usually OS threads under JRuby.

See Ruby Threading and JRuby Threading for specifics on these two implementations.

ObjectSpace

The ObjectSpace class encapsulates a list of all nontrivial objects that have been created during execution of Ruby and which have not yet been garbage collected. This list grows and shrinks over time as the number of objects in memory grows and shrinks.


Marshaling

Marshaling is the means by which Ruby implementations can serialize a graph of objects to an IO stream and reconstitute them back into objects again. For more information on object marshaling, including a binary specification, see Marshaling

Personal tools