| Class | Garden |
| In: |
lib/garden.rb
lib/garden_cycles.rb lib/rows.rb lib/rows_paths.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 (lp@spiralix.org) |
| Copyright: | 2008 Louis-Philippe Perron - Released under the terms of the MIT license |
| pid | [R] |
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 = Garden.new
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(4,2) { grow_block }