Stoplight is a distributed mutex server, based on the Sigma algorithm.
Mutual exclusion: No two different clients are in their critical sections at the same time.
Features:
- progress guaranteed in the face of process crashes (i.e. lockout-freedom, will not deadlock)
- assumes asynchronous and unreliable communication
- survives server and client memory loss
- endures messages being lost, duplicated or delivered out of order (non-FIFO)
- mutual exclusion guaranteed if
f<n/3
wheref
is the number of failed servers andn
is the total number of servers.
- ruby / rubygems / rake
gem sources --add http://gems.github.com
gem install auser-skelerl auser-dslify
cd stoplight
rake
.
|-- EMakefile
|-- INSTALL
|-- README.mkd
|-- deps # dependencies
|-- doc # documentation
|-- ebin # app, bootscripts, ebin files
|-- include # headers
|-- priv
| `-- tasks # rake tasks
|-- scripts # scripts to start/stop stoplight
|-- src # main source
`-- test # tests
Open three windows:
window 1.
STOPLIGHT_NODENAME="stoplight@your-ip" ./scripts/stoplight-server
window 2.
STOPLIGHT_SERVER="stoplight@your-ip" ./scripts/stoplight-client
1> {Resp, Pid} = stoplight_client:lock(green, 1000).
{crit,<6078.82.0>}
window 3.
STOPLIGHT_SERVER="stoplight@your-ip" ./scripts/stoplight-client
1> {Resp, Lob} = stoplight_client:lock(green).
{no,<6078.91.0>}
back to 2.
2> stoplight_client:release(Pid).
ok
back to 3.
2> {Resp2, Lob2} = stoplight_client:lock(green).
{crit,<6078.91.0>}
On Server Machine 1
STOPLIGHT_NODENAME="stoplight@192.168.133.128" ./scripts/stoplight-server
On Server Machine 2
STOPLIGHT_NODENAME="stoplight@192.168.1.66" STOPLIGHT_SERVER="toplight@192.168.133.128" ./scripts/stoplight-server
1> nodes().
['stoplight@192.168.133.128']
On Client Machine
STOPLIGHT_SERVER="stoplight@192.168.133.128" ./scripts/stoplight-client
stoplight servers
is a valid application
configuration option. This means
when starting the server you can specify a list of addresses to other servers
like so:
STOPLIGHT_NODENAME='stoplight@192.168.1.66' STOPLIGHT_SERVER_START_ARGS="-stoplight servers ['stoplight@192.168.133.128']" ./scripts/stoplight-server
- Stoplight Icon by alessandro "mentalrey" rei from his KDE "Dark Glass Icon Project" - http://www.mentalrey.it/project.html