ONCs – A distributed lisp virtual machine

The ONCs virtual machine consists of a large grid world holding ONC structures linked through local relative pointers. These linked ONC structures encode λ-expressions and perform calculation through λ-application. All actions consist of passing messages between ONCS. Messages are used to maintain reference counts (for garbage collection), to duplicate and replace linked ONC structures, and to propagate λ-applications across ONC structures.

The main design goals of this effort are

Table of Contents

1 Structures

1.1 ONC

Composed of integer reference and message counters and four pointers.

        an ONC
+-------------------+
|  #refs  |  #msgs  |
+---------+---------+
|  mcar   |  car    |
|         |         |
+---------+---------+
|  mcdr   |  cdr    |
|         |         |
+---------+---------+

Oncs perform the following actions.

  • reference count maintenance, an onc with ref≡0 is free
  • propagate and act on messages
  • find nearby free space for new oncs

1.2 Pointer

Composed of a header indicating type of contents, then car and cdr which hold integer values.

     a Pointer
+-----------------+
| hdr | car | cdr |
+-----------------+
headerinterpretation
NILnil
POINTERlocal pointer (car,cdr)
INTEGERinteger car+cdr
SYMBOLsymbol car (cdr for disambiguation?)
LAMBDAλ same as symbol
PRIMOPTprimitive integer operation
CURRIEDcurried primitive integer operation
BOOLEANBoolean true or false

1.3 Message

Composed of a coordinate and two pointers. Messages are passed between ONCS and cause ONCS to perform local actions. No global order on messages is required, only that for each particular onc (maybe even just for any given sender/receiver pair of oncs), the messages are received and processed in the order in which they are sent.

       a Message
+---------------------+
| coord | mcar | mcdr |
+---------------------+

The message values and their meanings are.

valueinterpretation
NILdefault, runs the waiting loop
INTEGERincrements or decrements the ref counter by value
LAMBDAλ-application, ptrs specify variable and value
EXTENDextend the end of the expression with by value
DUPLICATErequest target to duplicate itself to location
Replacerequest location to replace itself with contents
othersundefined

2 Usage

  1. Build
    make
    
  2. Optionally run all tests
    make check
    

    To run a particular test with verbose output do the following and press SPACEBAR to step through stages of evaluation.

    oncs$ ./test/fact-o-4.test -v|more -c
    

    Or, to just see the sequence of unique expressions.

    oncs$ ./test/fact-o-4.test -v|grep expr|uniq
    
  3. Run a REPL
    oncs$ ./repl
    > help
        quit -- quit the repl
         fix -- run until reaching a fixed point
        show -- show the contents of the ONC world
       clear -- clear the ONC world
     verbose -- toggle verbose execution
        help -- show this help message
        step -- run a single step
       print -- print a point in the world
       queue -- run down the queue
       showq -- show the queue
    
    All other inputs should be lambda calculus
    expressions.  Allowed atoms include...
    #Ln -- λn, `n' is an integer symbol identifier
    #Sn -- symbol n, `n' is an integer symbol identifier
      n -- literal integer `n'
     op -- where `op' is a primitive integer operation
           and op is one of (+ - * / = <)
    > (#L1 (= #S1 0) 1 (* #S1 2)) 0
    (#L1 (= #S1 0) 1 (* #S1 2)) 0
    > show
         0   1   2   3   4   5   6   7   8   9
     0                  p1^ i1_                
     1                  ^1_ s1^                
     2                  i1^ p1^                
     3                      ^1^                
     4                  i1_ L1^                
     5                      ^1^                
     6                                         
     7                                         
     8                  i1_                    
     9                  s1^                    
    > fix
    1
    > show
         0   1   2   3   4   5   6   7   8   9
     0                                         
     1                                         
     2                                         
     3                                         
     4                                         
     5                      i1_                
     6                                         
     7                                         
     8                                         
     9                                         
    > clear
    > (#L1 (= #S1 0) 1 (* #S1 2)) 8
    (#L1 (= #S1 0) 1 (* #S1 2)) 8
    > fix
    16
    > quit
    bye
    
  4. To view the progression of world states over the course of a test run execute the following. Note, this will only run if called from withing a gnu screen session as some screen scripting magic is used to turn the more command into a movie player. This will eat up your CPU and may well cause slower single-core computers to freeze.
    make play TEST=test/y-comb-2
    

    Here's a video of the above.

3 Platforms

  1. (working) Single threaded C.
  2. (pending) Distributed across a tribe of IXM. http://www.liquidware.com/shop/show/ixm/illuminato+x+machina
  3. (pending) Distributed across multiple GPU units using OpenCL. http://www.khronos.org/opencl/

Date: 2012-05-12T11:23-0400

Author: Eric Schulte

Org version Schulte with Emacs version 24

Validate XHTML 1.0