Nodal reduction

From Organic Design wiki
Revision as of 01:20, 4 November 2006 by Nad (talk | contribs) (The Nodal Reduction Algorithm: clean up)


Cone.png This article or section is a stub. Stubs are articles that have not yet received substantial attention from the authors. They are short or insufficient pieces of information and require additions to further increase the article's usefulness. The project values stubs as useful first steps toward complete articles.


+Nodal Reduction/Summary

The Nodal Reduction Algorithm

The reduction algorithm divides available execution up into quanta which are like "atoms" of change in that they're kind of indivisible. They have no definite rules about the amount of time they can take to execute, but should be generally infinitesimal (linearizable) compared to the macro scale. Any looping or iteration-based functionality should be implemented in terms of reducable structure (process). Top level nodal reduction is implemented as an infinite execute-quantum loop within the context of the root node of the local Nodal Space. The currently running nodal reduction algorithm is defined in nodeSpace.c and sites upon a list space defined in listSpace.c. The afore mentioned infinite execute-quanta loop is in peerd.c.


Associations

Each node has both associative content and a possible local state (which in nodeSpace.c is accessible via a list of pointers using the node-index in the nodes nodeDATA association as an index into an array of pointers). The associations are in the form of nodeRef:nodeRef pairs similar in concept to the key:value pairs of associative arrays, and the non-nodal data is in a form specific to the local runtime environment (if there is no state, it will be returned as the local environments representation of null).


Node names and references

All node referencing at runtime is done using list space indexes not names as in a normal object-model or associative array. For storage and distribution of nodal information, GUIDs are used. List-space references and GUIDs are used internally, but nodes can have context-specific names for external use. The names we use to refer to nodes here in the wiki are taken from the names of the constants to represent them in the peerd.c scripts.


Tree of loops

Using an association called nodeNEXT, allows the formation of loops of nodes (singly-linked-circular lists) within the local Nodal Space (loops also use a Prev association too so that nodes can easily be inserted or removed without needing to query other nodes). Combining this with another association called nodeLOOP allows the formation of a loop-tree starting at the root node (nodeROOT node with index zero). Following the nodeLOOP association from nodeROOT takes us down into another node, which is also part of a loop. Every traversal of a nodeLOOP takes us from an item in one loop to an item in another loop. The loop may contain zero items, but the idea here is that nodeLOOP's always connect items in loops, even though other associations may lead to other nodal structure which may or may not be a loop.


Loop rotation

Systems are formed from ongoing, reoccurring patterns which can be described in terms of rotation of the loops in the tree described above. Every time the nodal reduction process follows a nodeLOOP association it also rotates that loop, so that next time the same nodeLOOP association is traversed it will lead to the next node. This process is active (change occurs to the structure) but reversable, ie it's cyclic and non-entropic change.


Comsumption

The actual consumption of a quanta of execution occurs by calling the nodeReduce function which takes no parameters, but maintains its own persistent state defining the current focal node - just like a current working directory. The reduction function applies its quantum by first rotating the current focal node's loop and following its nodeLOOP association as described above, then checks if there's any non-nodal data, and if there is and it's a function reference it executes it and exits. If a function was executed, then that quantum is considered consumed and the next quantum is executed starting back at nodeROOT again. But if the data was not executable, then the nodeReduce function is called again, but remember that current focal node is now down one level because nodeLOOP was traversed, so the result is that the quanta of execution has been passed within. If there is no nodeLOOP association, the quantum is passed back up to nodeROOT unspent, but in practice this condition should not occur.

Here is the nodeReduce function from nodeSpace.c which is part of the currently running peerd.c nodal implementation.

[[+NR.c|]]


Division

As the nodal reduction process rotate the loops in the tree, all of the nodes in loops will periodically get execution focus. The period is longer depending on the depth of the loop, since each node is effectively dividing its share of quanta between its currently active child processes. This method of division is called multiplexing, see also Wikipedia's article.

Function execution & parameters

Currently the model is that an executing function binding can interact with the local global environment using either the languages own hash-table syntax as in nodal-wikid.pl, or using specific functions as in peer-nodal.as. Only the functional method is used now as in nodeSpace.c.

It seemed preferable to remove the concept of interfaces in order to give direct nodal access to the code, but wait states can occur in reads if they have to instantiate due to first-read which means that the function could easily take non-infinitesimal time to execute.

If we take a more UML/DOM-like approach we instead can nodally describe not only the OO and program flow control aspects, but also the function interfaces (names and entry/exit parameter lists). This means that the retrieval of the nodal information required to execute the function is being executed through nodal reduction.

The function itself executes after all information is present, and does not ever interact directly with the outside environment, so no nodal access syntax or functions are required.

See also

Whiteboard diagams

NOTE: the diagram is rotating the wrong way - it should rotate clockwise so that next's are right and prev's left.

Nodalreduction-text.jpg

Wickerbasket-text.jpg