Changes between Version 72 and Version 73 of Clojure Client Tutorial


Ignore:
Timestamp:
Aug 23, 2011 3:04:56 PM (13 years ago)
Author:
kedwar10
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Clojure Client Tutorial

    v72 v73  
    546546Although this example was meant to showcase the ways in which Clojure's support for concurrency and parallelism could represent collaborative planning, unfortunately the incorrect type was used to store the shared data, and as a result the program is not thread-safe (though still completes with high probability).  The problem arises in the value iteration algorithm, where the the function "max" is applied to a list that occasionally contains a nil value, which causes an exception (note that this exception doesn't show if the quagent is being run inside of a future and not a regular thread).  This probably occurs because updates to the shared data structure are not coordinated, and as a result, if one quagent is looking up value that another has yet to write, then a nil value will be returned.  This problem could be solved by using refs instead of atoms, since they can be coordinated without the possibility of race conditions.
    547547
     548To run a 2-quagent demo type the following (adding more than 2 can be problematic as the explorer is not robust to collisions.
     549
     550{{{
     551client.core=> (collab-explore)
     552nil
     553}}}
     554
    548555=== Rovers ===
    549556