A project I did for school. Try it here.
Here are some questions I've been asked about it:
This project is intended for visualizing distributed algorithms, specifically those described in "Distributed Algorithms: An Intuitive Approach" by Wan Fokkink.
These are algorithms that span multiple processes. This may be through shared memory, where independent processes can read and write to the same memory.
The other way is through message passing, where two processes communicate through a port, perhaps on a local- or wide-area network. Message passing is the kind of distributed algorithm this project is concerned with.
Try it and see! Click on Load Samples. Try Echo; load the sample code, and the sample graph, click the run button, and see how a spanning tree of a network is built.
You can watch messages as they get passed from one process to another, parents getting set, processes terminating, and so on.
It helps because these algorithms are inherently asynchronous and nondeterministic. Messages sent across channels are not necessarily first-in-first-out, and so it can be difficult sometimes to imagine how a distributed algorithm might behave.
That said, about 80% of my motivation for doing this was that I thought it'd be cool.
The algorithms are directly translated from the listing in the back of the book. AngularJS is used to hook Javascript into HTML elements. RequireJS is used for organizing modules. EaselJS is used to draw and animate shapes on the canvas. CodeMirror is used for the Javascript code editor (but not its evaluation). Twitter Bootstrap CSS is used for nicer looking buttons. AngularJS and Angular UI are also in use.
In Javascript. Take a look at the samples. To see what is available to
a Process p
, take a look at Process.js
. Beyond that, you can do all
the standard Javascript stuff, setting properties as you see fit.
jQuery's $
is available too.
I don't know, but I know what I'd like to do:
- Sample algorithms from every chapter in the book
- Pause, speed up, slow down the simulation
- Hovering the mouse over a process, channel, or message displays a tooltip containing information about it
- Track the life of a particular signal as it travels through the network
- Fix all the TODOs littering the code
- Figure out proper Javascript packaging
Yes! (・▽・)
...Yes (゚ペ)?