
Asynchronous Distributed System Simulator Implementation Project
Explore the implementation of an Asynchronous Distributed System Simulator in this comprehensive project by Daniel Servos. The simulation includes various features such as processors, links, algorithms, failures, and more, making it a versatile tool for network analysis. The project focuses on finding the network state at given times through synchronous and asynchronous simulations.
Uploaded on | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Simulator of an Asynchronous Distributed System CS9668: Internet Algorithmics Implementation Project April 22nd, 2015 Daniel Servos
Specification Create Asynchronous Distributed Network Simulator Take as input: Processors Links Algorithm Seed of each processor Delay of each link Probability that each link will fail Probability that each processor will fail Bizantine failures allowed Etc. Speeds and delays change over time GUI Easy to use
Specification Simulation Extras: Link bandwidth Byte errors Different algorithms at same time Multiple algorithms on one processor Ports Pause/restart simulation Simulation statistics Directional links Deterministic simulation
Specification GUI Extras: GUI based network editor Runtime algorithm loading/switching Common editing tools (copy, cut, paste, undo, redo) Export network graph as image Printing Full screen mode Zooming Logging
Objective Given: Settings S and starting network state To Find: Network state Ti for a given time i
Synchronous Simulation To Time Tn
Synchronous Simulation To P1 P3 P4 P2 Time Tn
Synchronous Simulation To P1 P3 P4 P2 P2 P1 P3 P4 Time Tn
Synchronous Simulation To P1 P3 P4 P2 P2 P1 P3 P4 P3 P1 Time P2 P4 Tn
Synchronous Simulation To P1 P3 P4 P2 P2 P1 P3 P4 P3 P1 Time P2 P4 P1 P3 P4 P2 P4 P1 P2 P3 Tn
Asynchronous Simulation To Time Tn
Asynchronous Simulation To P1 P3 P4 P2 Time Tn
Asynchronous Simulation To P1 P3 P4 P2 P1 P2 P3 P4 Time Tn
Asynchronous Simulation To P1 P3 P4 P2 P1 P2 P3 P4 P2 P1 P3 P4 Time Tn
Asynchronous Simulation To P1 P3 P4 P2 P1 P2 P3 P4 P2 P1 P1 P3 P4 P2 Time P1 P3 P4 P2 P3 P4 Tn
Asynchronous Simulation To P1 P3 P4 P2 P1 P2 P3 P4 P2 P1 P1 P3 P4 P2 Time P1 P3 Ti P4 P2 P3 P4 Tn
Asynchronous Simulation To P1 P3 P4 P2 P1 P2 P3 P4 P2 P4 P4 P4 P3 P2 Time P3 Ti P1 P2 P3 P1 P1 Tn
Deterministic Approach Maximum time required to complete one cycle of any algorithm being simulated. Max = Min = User define minimum tick speed 1 Tick = Min if Min > Max else Max
Deterministic Approach 0 1 2 Tick 3 4 5
Deterministic Approach Delay = 1 Delay = 2 Delay = 1 Delay = 3 0 P1 P3 1 P2 P4 2 Tick 3 4 5
Deterministic Approach Delay = 1 Delay = 2 Delay = 1 Delay = 3 0 P1 P3 1 P2 P1 P3 P4 2 Tick P2 3 4 P4 5
Deterministic Approach Delay = 1 Delay = 2 Delay = 1 Delay = 3 0 P1 P3 1 P2 P1 P3 P4 2 Tick P1 P3 P2 3 P1 P3 4 P4 P1 P3 P2 5
Deterministic Approach Delay = 1 Delay = 2 Delay = 1 Delay = 3 0 P1 P3 1 P2 P1 P4 P3 2 Tick P2 3 P1 P4 P3 4 P2 P4 P1 P3 5
Simulation Design Processor Link Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Link Settings Statistics Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Link Settings Statistics Target & Source Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Link Settings Statistics Target & Source Message Queue Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Settings Statistics Link Neighbours & Links Settings Statistics Target & Source Message Queue Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Settings Statistics Link Neighbours & Links Settings Statistics Target & Source Message Queue Q1 Algorithm A1 Legend Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Settings Statistics Link Neighbours & Links Shared Memory Settings Statistics Target & Source Message Queue Q1 Algorithm A1 Q2 Algorithm A2 Q3 Algorithm A3 Legend Qn Algorithm An Object Reference Collection (HashMap) Built in Object Class
Simulation Design Processor Settings Statistics Link Neighbours & Links Shared Memory M Settings M Statistics Pi Target & Source Message Queue Q1 Algorithm A1 Q2 Algorithm A2 Q3 Algorithm A3 Qn Algorithm An
Simulation Design Processor Settings Statistics Link Neighbours & Links Shared Memory Settings Statistics Target & Source Message Queue Q1 Algorithm A1 Q2 Algorithm A2 Q3 Algorithm A3 Tick Update Qn Algorithm An Network Manager
Simulation Design Processor Settings Statistics Link Neighbours & Links Shared Memory Settings Statistics Target & Source Message Queue Q1 Algorithm A1 M Q2 Algorithm A2 Q3 Algorithm A3 Qn Algorithm An
Simulation Design Network State Network Manager
Simulation Design Network State Link Settings Statistics Target & Source Message Queue Network Manager Link Settings Statistics Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n
Simulation Design Network State Settings Statistics Link Settings Statistics Target & Source Message Queue Network Manager Link Settings Statistics Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n
Simulation Design Network State Settings Statistics Link Settings Statistics Algorithms Target & Source Message Queue Network Manager Link Settings Statistics Target & Source Message Queue Link Tick Settings Statistics Target & Source Message Queue Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n
Simulation Design Network State Settings Statistics Link Settings Statistics Algorithms Target & Source Message Queue Network Manager Link Settings Statistics Target & Source Message Queue Network State Simulation Status Link Tick Settings Statistics Target & Source Message Queue Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n
GUI Design GUI GUI Handler Swing Graph Components Network State GUI GUI Handler Keyboard Handler
Interthread Communication Event Dispatching Thread Network State GUI Swing Settings Statistics Graph Components Link GUI Handler Keyboard Handler Settings Statistics Algorithms Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Link Tick Settings Statistics Target & Source Message Queue GUI Handler Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Network State GUI Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n Network Manager Network State Simulation Status
Interthread Communication Event Dispatching Thread Network State GUI Swing Settings Statistics Graph Components Link GUI Handler Keyboard Handler Settings Statistics Algorithms Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Link Tick Settings Statistics Target & Source Message Queue GUI Handler Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Network State GUI Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n Network Manager Network State Simulation Status
Interthread Communication Swing Thread Network State GUI Swing Settings Statistics Graph Components Link GUI Handler Keyboard Handler Settings Statistics Algorithms Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Link Tick Settings Statistics Target & Source Message Queue GUI Handler Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Network State GUI Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n Event Queue Network Manager Network State Simulation Status
Interthread Communication Swing Thread Network State GUI Swing Settings Statistics Graph Components Link GUI Handler Keyboard Handler Settings Statistics Algorithms Target & Source Message Queue Link Settings Statistics Target & Source Message Queue Link Tick Settings Statistics Target & Source Message Queue GUI Handler Processor Processor Processor Settin gs Statis tics Settin gs Statis tics Settin gs Statis tics Network State GUI Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Neigh bours & Links Shar ed Mem ory Q Algorithm A1 Q Algorithm A1 Q Algorithm A1 1 1 1 Q Algorithm A2 Q Algorithm A2 Q Algorithm A2 2 2 2 Q Algorithm A3 Q Algorithm A3 Q Algorithm A3 3 3 3 Q Algorithm An Q Algorithm An Q Algorithm An n n n Event Event Queue Network Manager Network State Simulation Status Event
Algorithm Design Algorithm Message {abstract} {leaf} +getID(): String {leaf} +getPort(): int {leaf} +send(msg: Message): boolean {leaf} +receive(wait: boolean): Message {leaf} +getNeighbors(): String[] {leaf} +getLinks(): String[] {leaf} +print(text: String) {leaf} +display(text: String) {leaf} +doMainLoop(): boolean {leaf} +terminate() {leaf} +algorithm(): Object {abstract} ... +Message(toID: String, msg: String) +Message(toID: String, msg: String, port: int) +from(): String +to(): String +link(): String +message(): String +size(): int +port(): int +sourcePort(): int +toString(): String +toInt(): int ...
Algorithm Design import dans.algorithm.Algorithm; import dans.algorithm.Message; publicclass MyAlgorithm extends Algorithm { @Override publicObject algorithm() { //Do algorithm setup here while(doMainLoop()) { //Main algorithm code //Break, return, or call terminate() when done } //Code to run before termination return MyResults; } }
Implementation Details Java 8 JGraphX - Graph visualization Swing - Basic GUI components JLFGR Java look and feel graphics repository (icon images)
Implementation Details SLOC-P 4% 31% GUI Algorithm Network 56% Utils 9% Symbol Count Definition Source Files 54 Source Files Directories 7 Directories LOC 9825 Lines of Code BLOC 1584 Blank Lines of Code SLOC-P 7707 Physical Executable Lines of Code SLOC-L 6077 Logical Executable Lines of Code