From: <sul...@us...> - 2007-08-29 01:09:43
|
Revision: 38 http://gridsim.svn.sourceforge.net/gridsim/?rev=38&view=rev Author: sulistio Date: 2007-08-28 18:09:42 -0700 (Tue, 28 Aug 2007) Log Message: ----------- finalize this example description. Modified Paths: -------------- branches/gridsim4.0-branch1/examples/ResFailureEx01/GridUserFailureEx01.java branches/gridsim4.0-branch1/examples/ResFailureEx01/README.txt branches/gridsim4.0-branch1/examples/ResFailureEx01/ResFailureEx01.java Modified: branches/gridsim4.0-branch1/examples/ResFailureEx01/GridUserFailureEx01.java =================================================================== --- branches/gridsim4.0-branch1/examples/ResFailureEx01/GridUserFailureEx01.java 2007-08-29 01:01:34 UTC (rev 37) +++ branches/gridsim4.0-branch1/examples/ResFailureEx01/GridUserFailureEx01.java 2007-08-29 01:09:42 UTC (rev 38) @@ -94,38 +94,9 @@ gridletLatencyTime = new double[NUM_GRIDLETS]; } - /** - * This function retrieves a list of available resources from the GIS. - * @return an array containing the ids of the resources - */ - private int[] getResList() - { - Object[] resList = super.getLocalResourceList(); - int resourceID[] = null; - - // if we have any resource - if ((resList != null) && (resList.length != 0)) - { - resourceID = new int[resList.length]; - for (int x = 0; x < resList.length; x++) - { - // Resource list contains list of resource IDs - resourceID[x] = ((Integer) resList[x]).intValue(); - - if (trace_flag == true) - { - System.out.println(super.get_name() + - ": resource[" + x + "] = " + resourceID[x]); - } - } - - } - - return resourceID; - } - /** * Handles incoming requests to this entity. + * This method specifies the behaviours and/or scenarios of a user. */ public void body() { @@ -185,6 +156,7 @@ gridletLatencyTime); } // body() + ///////////////////////////////////////////////////////////////////////// /** * This functions process the submission of a gridlet. We have to get the @@ -295,7 +267,6 @@ } // processGridletSubmission - /** * This functions process the return of a gridlet. * We pay attention to the status of the gridlet @@ -733,4 +704,34 @@ } } + /** + * This function retrieves a list of available resources from the GIS. + * @return an array containing the ids of the resources + */ + private int[] getResList() + { + Object[] resList = super.getLocalResourceList(); + int resourceID[] = null; + + // if we have any resource + if ((resList != null) && (resList.length != 0)) + { + resourceID = new int[resList.length]; + for (int x = 0; x < resList.length; x++) + { + // Resource list contains list of resource IDs + resourceID[x] = ((Integer) resList[x]).intValue(); + + if (trace_flag == true) + { + System.out.println(super.get_name() + + ": resource[" + x + "] = " + resourceID[x]); + } + } + + } + + return resourceID; + } + } // end class Modified: branches/gridsim4.0-branch1/examples/ResFailureEx01/README.txt =================================================================== --- branches/gridsim4.0-branch1/examples/ResFailureEx01/README.txt 2007-08-29 01:01:34 UTC (rev 37) +++ branches/gridsim4.0-branch1/examples/ResFailureEx01/README.txt 2007-08-29 01:09:42 UTC (rev 38) @@ -1,68 +1,69 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * An example of how to use the failure functionality. - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Author: Agustin Caminero and Anthony Sulistio - * Organization: UCLM (Spain) - * Created on: August 2007 - */ - -Welcome to the example of how to use the computing resource failure functionality -To compile the example source code: - In Unix/Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. ResFailureEx01.java - In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. ResFailureEx01.java - -where $GRIDSIM or %GRIDSIM% is the location of the gridsimtoolkit package. - - -To run the class file: - In Unix/Linux: - java -classpath $GRIDSIM/jars/gridsim.jar:. ResFailureEx01 network_ex01.txt > file.txt - - In Windows: - java -classpath %GRIDSIM%\jars\gridsim.jar;. ResFailureEx01 network_ex01.txt > file.txt - - -The above command means run the program and output the results into a file -named "file.txt" rather than into screen or standard output. -To prevent from overwriting an existing file, I renamed "file.txt" into -"output.txt" -NOTE: This example uses Java Random class to select a resource and user entity - to communicate to a regional GIS entity. - Hence, when running this example many times, the values will be different. - - -When running the example file, it will produce the following files: - - sim_trace -> created by the SimJava2 package (lower-level) to trace every - events (performed by SimJava and GridSim) during the simulation. - We don't need to worry about this file. Not to important for our - example. - - sim_report -> created by the SimJava2 package (lower-level) of GridSim. - This is a simulation report that contains general information about - running this experiment. We don't need to worry about this file. - Not to important for our example. - - Ex01_Regional_GIS -> contains one line describing each - registering/removing event that takes place at the GIS. Resources will - register at the begining of simulations, and after recovering from a - failure affecting all their machines. Resources will be removed when - they suffer a failure affecting all their machines. - - Ex01_Res_0, Ex01_Res_1, Ex01_Res_2: these files record when a resource suffers a failure - and when it recovers from the failure. They also say how many machines - failed, and the time of the fail/recovery. - - Ex01_User0: contains one line for each event regarding to the gridlets. - These events are the sending/reception of a gridlet, and each line include the status of the gridlet, - time, resource and VO. In this example we only have 1 VO. - - Ex01_User0_Fin: contains one line for each gridlet, showing the resource - it has been executed, its cost, CPU time and total latency. - -NOTE: When you run the program multiple times, all existing files will be overwritten. - +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * An example of how to use the failure functionality. + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero and Anthony Sulistio + * Organization: UCLM (Spain) + * Created on: August 2007 + */ + +Welcome to the example of how to use the computing resource failure functionality +To compile the example source code: + In Unix/Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. ResFailureEx01.java + In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. ResFailureEx01.java + +where $GRIDSIM or %GRIDSIM% is the location of the gridsimtoolkit package. + + +To run the class file: +In Unix/Linux: + java -classpath $GRIDSIM/jars/gridsim.jar:. ResFailureEx01 network_ex01.txt > file.txt + +In Windows: + java -classpath %GRIDSIM%\jars\gridsim.jar;. ResFailureEx01 network_ex01.txt > file.txt + + +The above command means run the program and output the results into a file +named "file.txt" rather than into screen or standard output. +To prevent from overwriting an existing file, +I renamed "file.txt" into "output.txt" + +NOTE: This example uses probabilistic distributions and random variables. + Hence, when running this example many times, the values will be different. + + +When running the example file, it will produce the following files: + + sim_trace -> created by the SimJava2 package (lower-level) to trace every + events (performed by SimJava and GridSim) during the simulation. + We don't need to worry about this file. Not to important for our + example. + + sim_report -> created by the SimJava2 package (lower-level) of GridSim. + This is a simulation report that contains general information about + running this experiment. We don't need to worry about this file. + Not to important for our example. + + Ex01_Regional_GIS -> contains one line describing each + registering/removing an event that takes place at the GIS. Resources + register in the begining of simulations, and after recovering from a + failure affecting all their machines. Resources will be removed when + they suffer a failure affecting all their machines. + + Ex01_Res_0, Ex01_Res_1, Ex01_Res_2 -> records when the resource + suffers a failure and when it recovers from the failure. It also records + how many machines failed, and the time of the fail/recovery. + + Ex01_User0 -> contains one line for each event regarding to the Gridlets. + These events are the sending/reception of a gridlet, and + each line include the status of the gridlet, + time, resource and VO. In this example we only have 1 VO. + + Ex01_User0_Fin -> contains one line for each gridlet, showing the resource + it has been executed, its cost, CPU time and total latency. + +NOTE: When you run the program multiple times, the new statistics will be + appended at the end of a file. Modified: branches/gridsim4.0-branch1/examples/ResFailureEx01/ResFailureEx01.java =================================================================== --- branches/gridsim4.0-branch1/examples/ResFailureEx01/ResFailureEx01.java 2007-08-29 01:01:34 UTC (rev 37) +++ branches/gridsim4.0-branch1/examples/ResFailureEx01/ResFailureEx01.java 2007-08-29 01:09:42 UTC (rev 38) @@ -39,6 +39,7 @@ return; } + ////////////////////////////////////////// // First step: Initialize the GridSim package. It should be called // before creating any entities. We can't run this example without @@ -55,6 +56,7 @@ GridSim.init(num_user, calendar, trace_flag); trace_flag = true; + ////////////////////////////////////////// // Second step: Builds the network topology among Routers. @@ -99,7 +101,7 @@ // failure message according to these patterns. RegionalGISWithFailure gis = new RegionalGISWithFailure(gisName, link, failureNumResPattern, failureTimePattern, - failureLengthPattern, 0); // TODO: 0 is redundant ? + failureLengthPattern); gis.setTrace(trace_flag); // record this GIS activity // link these GIS to a router @@ -155,6 +157,7 @@ " and registered to " + gis.get_name() ); } + ////////////////////////////////////////// // Fifth step: Creates one GridUserFailure entity, // linked to a router of the topology @@ -245,8 +248,8 @@ * @return a GridResource object */ private static GridResourceWithFailure createGridResource(String name, - double baud_rate, double delay, int MTU, int totalPE, - int totalMachine, int rating, String sched_alg) + double baud_rate, double delay, int MTU, int totalPE, + int totalMachine, int rating, String sched_alg) { // Here are the steps needed to create a Grid resource: // 1. We need to create an object of MachineList to store one or more This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |