From: <mar...@us...> - 2008-02-27 23:36:08
|
Revision: 135 http://gridsim.svn.sourceforge.net/gridsim/?rev=135&view=rev Author: marcos_dias Date: 2008-02-27 15:36:05 -0800 (Wed, 27 Feb 2008) Log Message: ----------- Small changes in the allocation policies. They do not affect any simulation results obtained with the previous versions. Modified Paths: -------------- branches/gridsim4.0-branch3/source/gridsim/Accumulator.java branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java Modified: branches/gridsim4.0-branch3/source/gridsim/Accumulator.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/Accumulator.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/Accumulator.java 2008-02-27 23:36:05 UTC (rev 135) @@ -4,7 +4,6 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * - * $Id: Accumulator.java,v 1.2 2007/11/05 06:33:29 marcosd Exp $ */ package gridsim; @@ -94,70 +93,158 @@ /** * Calculates the mean of accumulated items + * @deprecated As of GridSim 2.1, replaced by {@link #getMean()} * @return the mean of accumalated items * @pre $none * @post $none */ + public double mean() { + return this.getMean(); + } + + /** + * Calculates the mean of accumulated items + * @return the mean of accumalated items + * @pre $none + * @post $none + */ public double getMean() { return mean_; } /** * Calculates the standard deviation of accumulated items + * @deprecated As of GridSim 2.1, replaced by + * {@link #getStandardDeviation()} * @return the Standard Deviation of accumulated items * @pre $none * @post $none */ + public double sd() { + return this.getStandardDeviation(); + } + + /** + * Calculates the standard deviation of accumulated items + * @return the Standard Deviation of accumulated items + * @pre $none + * @post $none + */ public double getStandardDeviation() { - return sqrMean_ - (mean_ * mean_); + return Math.sqrt( this.getVariance() ); } /** + * Calculates the variance of accumulated items + * @return the Standard Deviation of accumulated items + * @pre $none + * @post $none + */ + public double getVariance() { + return sqrMean_ - (mean_ * mean_); + } + + /** * Finds the smallest number of accumulated items + * @deprecated As of GridSim 2.1, replaced by {@link #getMin()} * @return the smallest of accumulated items * @pre $none * @post $none */ + public double min() { + return this.getMin(); + } + + /** + * Finds the smallest number of accumulated items + * @return the smallest of accumulated items + * @pre $none + * @post $none + */ public double getMin() { return min_; } /** * Finds the largest number of accumulated items + * @deprecated As of GridSim 2.1, replaced by {@link #getMax()} * @return the largest of accumulated items * @pre $none * @post $none */ + public double max() { + return this.getMax(); + } + + /** + * Finds the largest number of accumulated items + * @return the largest of accumulated items + * @pre $none + * @post $none + */ public double getMax() { return max_; } /** * Finds the last accumulated item + * @deprecated As of GridSim 2.1, replaced by {@link #getLast()} * @return the last accumulated item * @pre $none * @post $none */ + public double last() { + return this.getLast(); + } + + /** + * Finds the last accumulated item + * @return the last accumulated item + * @pre $none + * @post $none + */ public double getLast() { return last_; } /** * Counts the number of items accumulated so far + * @deprecated As of GridSim 2.1, replaced by {@link #getCount()} * @return the number of items accumulated so far * @pre $none * @post $result >= 0 */ + public int count() { + return this.getCount(); + } + + /** + * Counts the number of items accumulated so far + * @return the number of items accumulated so far + * @pre $none + * @post $result >= 0 + */ public int getCount() { return n_; } /** * Calculates the sum of accumulated items + * @deprecated As of GridSim 2.1, replaced by {@link #getSum()} * @return the sum of accumulated items * @pre $none * @post $none */ + public double sum() { + return this.getSum(); + } + + /** + * Calculates the sum of accumulated items + * @return the sum of accumulated items + * @pre $none + * @post $none + */ public double getSum() { return n_ * mean_; } @@ -165,9 +252,20 @@ /** * Determines the size of Accumulator object * @return the size of this object + * @deprecated As of GridSim 2.1, replaced by {@link #getByteSize()} * @pre $none * @post $result > 0 */ + public static int ByteSize() { + return getByteSize(); + } + + /** + * Determines the size of Accumulator object + * @return the size of this object + * @pre $none + * @post $result > 0 + */ public static int getByteSize() { int totalInt = 4; // contains only 1 int Modified: branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/AllocPolicy.java 2008-02-27 23:36:05 UTC (rev 135) @@ -419,7 +419,7 @@ /** * Calculates the current load of a GridResource for a given number of * Gridlets currently in execution. This method can be overridden by - * child class, if the below algorithm doesn't suitable for a particular + * child class, if the below algorithm isn't suitable for a particular * type of scheduling: * <code> * <br> <br> Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARCBMultiplePartitions.java 2008-02-27 23:36:05 UTC (rev 135) @@ -609,7 +609,7 @@ // Start the execution of Gridlets that are queued and whose // potential start execution time is smaller than current time - itemsStarted += super.startQueuedGridlets(currentTime); + itemsStarted += super.backfillGridlets(currentTime); //---------------- USED FOR DEBUGGING PURPOSES ONLY -------------------- Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBMultiplePartitions.java 2008-02-27 23:36:05 UTC (rev 135) @@ -371,7 +371,7 @@ * @param currentTime the current simulation time * @return the number of gridlets started */ - protected int startQueuedGridlets(double currentTime) { + protected int backfillGridlets(double currentTime) { int gridletStarted = 0; // Start the execution of Gridlets that are queued and whose Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-27 23:36:05 UTC (rev 135) @@ -177,7 +177,14 @@ Sim_event ev = new Sim_event(); while ( Sim_system.running() ) { super.sim_get_next(ev); - processEvent(ev); + + // if the simulation finishes then exit the loop + if (ev.get_tag() == GridSimTags.END_OF_SIMULATION || + super.isEndSimulation() == true) { + break; + } + + processEvent(ev); } // CHECK for ANY INTERNAL EVENTS WAITING TO BE PROCESSED Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBMultiplePartitions.java 2008-02-27 23:36:05 UTC (rev 135) @@ -331,19 +331,13 @@ } sgl.setPartitionID(queueId); - - // If there are no jobs in the queue list, then check if - // there are enough PEs to process the job immediately - boolean success = startGridlet(sgl); - // if the job could not be scheduled immediately, then enqueue it - if(!success) { - scheduleGridlet(sgl); - queuedGridlets_.add(sgl); - - // order gridlets according to their priorities - Collections.sort(queuedGridlets_, orderByPriority_); - } + sgl.setStatus(Gridlet.QUEUED); + queuedGridlets_.add(sgl); + + // order gridlets according to their priorities + Collections.sort(queuedGridlets_, orderByPriority_); + backfillGridlets(GridSim.clock()); //------------------ FOR DEBUGGING PURPOSES ONLY ---------------- @@ -666,7 +660,7 @@ sgl.setPERangeList(ranges); // change Gridlet status - sgl.setStatus(Gridlet.QUEUED); +// sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); sgl.setActualFinishTime(finishTime); @@ -742,7 +736,7 @@ // Start the execution of Gridlets that are queued and whose // potential start execution time is smaller than current time - itemsStarted = startQueuedGridlets(currentTime); + itemsStarted = backfillGridlets(currentTime); //---------------- USED FOR DEBUGGING PURPOSES ONLY -------------------- @@ -781,13 +775,14 @@ } /** - * This method starts gridlets that are in the queue and - * whose start time is smaller than the reference time and updates - * the availability profile and ranges of PEs currently available accordingly + * This method starts/backfills that are in the queue and pivots (first jobs + * in the partitions) whose start time is smaller than the reference time + * and updates the availability profile and ranges of PEs + * currently available accordingly * @param currentTime the current simulation time * @return the number of gridlets started */ - protected int startQueuedGridlets(double currentTime) { + protected int backfillGridlets(double currentTime) { int gridletStarted = 0; // first checks whether the pivots can be started Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java =================================================================== --- branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-26 04:57:09 UTC (rev 134) +++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-27 23:36:05 UTC (rev 135) @@ -217,21 +217,9 @@ //---------------------------------------------------------- - // If there are no jobs in the queue list, then check if - // there are enough PEs to process the job immediately - boolean success = false; - int freePE = super.resource_.getNumFreePE(); - - if( reqPE <= freePE ) { - success = startGridlet(sgl); - } - - // if the job could not be scheduled immediately, then - // it has to be put in the waiting queue - if(!success) { - scheduleGridlet(sgl); - queuedGridlets_.add(sgl); - } + sgl.setStatus(Gridlet.QUEUED); + queuedGridlets_.add(sgl); + backfillGridlets(GridSim.clock()); // sends back an ack if required if (ack == true) { @@ -490,7 +478,7 @@ sgl.setPERangeList(selected); // changes the Gridlet status - sgl.setStatus(Gridlet.QUEUED); +// sgl.setStatus(Gridlet.QUEUED); sgl.setStartTime(startTime); sgl.setActualFinishTime(finishTime); pivot_ = sgl; @@ -576,7 +564,6 @@ if(finishTime > shadowTime_) extraPEs_ = PERangeList.difference(extraPEs_, selected); - } /** @@ -662,7 +649,7 @@ resource_.resetFreePERanges(currentStatus.getPERanges()); } - itemsStarted = startQueuedGridlets(currentTime); + itemsStarted = backfillGridlets(currentTime); //---------------- USED FOR DEBUGGING PURPOSES ONLY -------------------- @@ -675,13 +662,11 @@ } /** - * This method starts gridlets that are in the queue and - * whose start time is smaller than the reference time and updates - * the availability accordingly + * This method backfills/starts gridlets that are in the queue * @param currentTime the current simulation time * @return the number of gridlets started */ - protected int startQueuedGridlets(double currentTime) { + protected int backfillGridlets(double currentTime) { int gridletStarted = 0; // first checks the pivot first @@ -720,7 +705,7 @@ * @param sgl a SSGridlet object * @param status the Gridlet status */ - private void gridletFinish(SSGridlet sgl, int status) { + protected void gridletFinish(SSGridlet sgl, int status) { // the order is important! Set the status first then finalise // due to timing issues in SSGridlet class sgl.setStatus(status); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |