This repository contains a Java simulation of a distributed processor load balancing algorithm. The main entry point is src/Main.java.
- Java JDK 8 or later installed
- A command-line terminal (PowerShell, Command Prompt, or similar)
src/- Java source filessrc/Main.java- program entry pointsrc/Processor/- processor and task classessrc/Simulation/- simulation enginesrc/Strategies/- strategy classes for processor load balancing
From the repository root, run the following commands:
- Compile all Java sources into an output directory:
javac -d out src\Main.java src\Processor\*.java src\Round\*.java src\Simulation\*.java src\Strategies\*.java- Run the simulation:
java -cp out Main- The main simulation parameters are configured in
src/Main.java. - After running, the program prints statistics and shows charts based on the simulation results if the charting dependency is available.
src/Simulation/Simulation.java depends on JFreeChart classes (org.jfree.chart.* and org.jfree.data.*). To compile and run the charting functionality, download the JFreeChart library and add the JAR to the classpath.
Example with a downloaded JAR named jfreechart-1.5.3.jar:
javac -cp jfreechart-1.5.3.jar -d out src\Main.java src\Processor\*.java src\Round\*.java src\Simulation\*.java src\Strategies\*.java
java -cp "out;jfreechart-1.5.3.jar" MainIf you do not want to use charts, comment out or remove the simulation.showCharts(); call in src/Main.java.
If you prefer one command for both compilation and execution:
javac -d out src\Main.java src\Processor\*.java src\Simulation\*.java src\Strategies\*.java ; java -cp out Main