Version: 1.0
Author: Adrian Kosmaczewski
Date: March 1st, 2007
Programming Languages: Java 5
Tools: Eclipse
Platforms: Windows, Mac
Downloads: bridgetest.zip
Licence: Creative Commons Public Domain
This is a solution to this “classic” synchronization problem: there is a one-way bridge that can hold up to three cars; they arrive at one end of the bridge and exit the bridge at the other end. Traffic is allowed only in the one, available, direction. This Java 5 application creates one thread per car, and concurrently tries to make them cross the bridge.
To build and run it, just use the provided batch file (or shell script if you are in a *nix system!)