Class Garden
In: lib/garden.rb
Parent: Object

These classes provides the garden part of the Gardener,Garden,Seed natural design patern

The Garden is where the thread concurency is implemented, offering itself as a thread queue manager, dispatching seeds from the Gardener to its Rows child class and back again. it does so using its child class, the Rows. Since Ruby doesn‘t implement Native Threads, and only Native Threads scales to multi-core execution, the way to implement concurent execution is through splitting the task at hand between multiple single threaded parallel executions. The Rows system does exactly that, using the Ruby fork function, then connecting the isolated running processes to the Garden, through a simple socket system provided by the Toolshed Module.

Author:lp (
Copyright:2008 Louis-Philippe Perron - Released under the terms of the MIT license


new   rows  

Included Modules

Cycles Toolshed

Classes and Modules

Module Garden::Cycles
Class Garden::Rows


pid  [R] 

Public Class methods

The new class method initializes the Garden. As part of the Abundance lib, Garden is not initialized directly, but rather as a side effect of the Gardener‘s initialization. Its instance resides in the @garden Gardener‘s instance variable. Its real muscles are inaccessibles from instance method intervention, because of its nature as a forked Ruby process.


 garden =

Public Instance methods

The rows method for the Garden instance allow instantiation of its child Rows. As part of the Abundance lib, Garden.rows is not invoked directly, but rather as a side effect of the Gardener‘s initialization. Its in reality an indirect initializer for the Rows class.


  • rows = garden rows number, the number of concurent threads
  • init_timeout = allow to pause execution to allow for larger garden rows to initialize


 rows = garden.rows(4,2) { grow_block }