|
From: <mar...@us...> - 2008-02-12 05:42:46
|
Revision: 100
http://gridsim.svn.sourceforge.net/gridsim/?rev=100&view=rev
Author: marcos_dias
Date: 2008-02-11 21:42:41 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
A scheduler with multiple queues and easy backfilling is under development.
Modified Paths:
--------------
branches/gridsim4.0-branch3/source/gridsim/GridResource.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java
branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java
branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java
branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java
Modified: branches/gridsim4.0-branch3/source/gridsim/GridResource.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/GridResource.java 2008-02-11 23:42:40 UTC (rev 99)
+++ branches/gridsim4.0-branch3/source/gridsim/GridResource.java 2008-02-12 05:42:41 UTC (rev 100)
@@ -13,6 +13,7 @@
import gridsim.turbo.ARParallelSpaceShared;
import gridsim.turbo.EBParallelSpaceShared;
import gridsim.turbo.CBParallelSpaceShared;
+import gridsim.turbo.MultipleEasyBackfillingQueues;
import gridsim.turbo.TAllocPolicy;
import gridsim.turbo.TResourceCharacteristics;
import gridsim.index.*;
@@ -646,6 +647,11 @@
policy_ = new ARParallelSpaceShared(super.get_name(), "ARParallelSpaceShared");
break;
+ case TResourceCharacteristics.MULTIPLE_EASY_BACKFILLING_QUEUES:
+ policy_ = new MultipleEasyBackfillingQueues(super.get_name(),
+ "MultipleEasyBackfillingQueues");
+ break;
+
default:
throw new Exception(super.get_name()+" : Error - supports"+
" only TimeShared or SpaceShared policy.");
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2008-02-11 23:42:40 UTC (rev 99)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2008-02-12 05:42:41 UTC (rev 100)
@@ -27,7 +27,7 @@
public interface ARTPolicy {
/**
- * An abstract method that handles a new advanced reservation request.
+ * A method that handles a new advanced reservation request.
* @param message the advance reservation message received requesting
* the reservation
* @pre message != null
@@ -35,7 +35,7 @@
void handleCreateReservation(ARMessage message);
/**
- * An abstract method that handles a modify reservation request.
+ * A method that handles a modify reservation request.
* @param message the advance reservation message received requesting
* the change
* @pre message != null
@@ -43,7 +43,7 @@
void handleModifyReservation(ARMessage message);
/**
- * An abstract method that handles a cancel reservation request.
+ * A method that handles a cancel reservation request.
* @param message the advance reservation message received requesting
* the cancellation
* @pre message != null
@@ -51,21 +51,21 @@
void handleCancelReservation(ARMessage message);
/**
- * An abstract method that handles a commit reservation request.
+ * A method that handles a commit reservation request.
* @param message the advance reservation message received
* @pre message != null
*/
void handleCommitReservation(ARMessage message);
/**
- * An abstract method that handles a query reservation request.
+ * A method that handles a query reservation request.
* @param message the advance reservation message received
* @pre message != null
*/
void handleQueryReservation(ARMessage message);
/**
- * An abstract method that handles a query free time request.
+ * A method that handles a query free time request.
* @param message the advance reservation message received
* @pre message != null
*/
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-11 23:42:40 UTC (rev 99)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/CBParallelSpaceShared.java 2008-02-12 05:42:41 UTC (rev 100)
@@ -1076,7 +1076,6 @@
break;
}
else {
- // Sep. 29, 2007 - Changed by Marcos
// if the finish time is equals to the entry time, so there
// is no need to check the intersection
if(nextEntry.getTime() < potFinishTime) {
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-11 23:42:40 UTC (rev 99)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/EBParallelSpaceShared.java 2008-02-12 05:42:41 UTC (rev 100)
@@ -21,8 +21,8 @@
/**
* <tt>EBParallelSpaceShared</tt> class is an allocation policy for
- * <tt>GridResource</tt> that behaves exactly like First Come First
- * Served (FCFS) with aggressive backfilling (EASY). The policy is based
+ * <tt>GridResource</tt> that implements First Come First Served (FCFS)
+ * with aggressive backfilling (EASY). The policy is based
* on the conservative backfilling algorithm described in the
* following papers:
* <p>
@@ -41,11 +41,10 @@
* This policy maintains an availability profile. The availability
* profile contains information about the ranges of processing elements
* (PEs) that will be released when the running jobs complete.
- * In addition, it maintains the list of extra nodes, that is, the nodes
+ * In addition, the policy maintains the list of extra nodes, that is, the nodes
* that are left when the first job of the waiting queue is scheduled.
* We recommend you to read the papers mentioned above if you want to
* understand this policy.
- *
* <p>
* <b>LIMITATIONS:</b><br>
* <ul>
@@ -53,10 +52,11 @@
* homogeneous.
* <li> Local load is not considered. If you would like to
* simulate this, you have to model the local load as gridlets.
- * It is more precise and faster.
+ * It is more precise and faster. To do so, please check
+ * {@link Lublin99Workload}.
* <li> Gridlets cannot be paused nor migrated. This could be
* easily done, but due to time constraints, I could not
- * implement these.
+ * implement these features.
* </ul>
*
* @author Marcos Dias de Assuncao
@@ -64,7 +64,7 @@
*
* @see gridsim.GridSim
* @see gridsim.ResourceCharacteristics
- * @see gridsim.AllocPolicy
+ * @see gridsim.turbo.TAllocPolicy
* @see gridsim.turbo.CBParallelSpaceShared
* @see gridsim.turbo.PERange
* @see gridsim.turbo.PERangeList
@@ -73,19 +73,19 @@
public class EBParallelSpaceShared extends TAllocPolicy {
// Queue of waiting Gridlets
- private LinkedList<SSGridlet> queuedGridlets_;
+ protected LinkedList<SSGridlet> queuedGridlets_;
// Queue of running Gridlets
- private LinkedList<SSGridlet> runningGridlets_;
+ protected LinkedList<SSGridlet> runningGridlets_;
// The rating of one PE
- private int ratingPE_;
+ protected int ratingPE_;
// a list containing the availability of PEs
- private AvailabilityProfile availProfile_;
+ protected AvailabilityProfile availProfile_;
// the resource characteristics object to be used
- private TResourceCharacteristics resource_;
+ protected TResourceCharacteristics resource_;
// the last time when the schedule updated was called
private double lastScheduleUpdate_;
@@ -101,7 +101,7 @@
private PERangeList allPEs_;
// a tag to indicate that a gridlet has finished
- private static final int GRIDLET_FINISHED = 10;
+ private static final int UPDATE_SCHEDULE_TAG = 10;
/**
* Allocates a new <tt>EBParallelSpaceShared</tt> object
@@ -162,19 +162,8 @@
super.isEndSimulation() == true) {
break;
}
-
- // Internal Event if the event source is this entity
- if (ev.get_src() == super.myId_ &&
- ev.get_tag() == GRIDLET_FINISHED) {
- double currentTime = GridSim.clock();
- if(currentTime > lastScheduleUpdate_) {
- updateSchedule();
- }
- lastScheduleUpdate_ = currentTime;
- }
- else {
- processOtherEvent(ev);
- }
+
+ processEvent(ev);
}
// CHECK for ANY INTERNAL EVENTS WAITING TO BE PROCESSED
@@ -185,11 +174,18 @@
System.out.println(super.get_name() + ".body(): ignore internal events");
}
+ // reset variables to default values
queuedGridlets_.clear();
runningGridlets_.clear();
availProfile_.clear();
+ lastScheduleUpdate_ = 0.0D;
+ shadowTime_ = Double.MAX_VALUE;
+ ratingPE_ = 0;
+ resource_.resetFreePERanges();
+ extraPEs_ = resource_.getFreePERanges().clone();
+ allPEs_ = extraPEs_.clone();
}
-
+
/**
* Schedules/adds to the queue a new <tt>Gridlet</tt> received by the
* <tt>GridResource</tt> entity.
@@ -242,7 +238,8 @@
// Notifies the listeners that a Gridlet has been either scheduled
// to run immediately or put in the waiting queue
- GridSim.notifyListeners(this.get_id(), AllocationAction.ITEM_SCHEDULED, true, sgl);
+ GridSim.notifyListeners(this.get_id(),
+ AllocationAction.ITEM_SCHEDULED, true, sgl);
//---------------------------------------------------------------
}
@@ -350,20 +347,48 @@
// -------------------- PRIVATE METHODS ----------------------------
+ /**
+ * Process and event sent to this entity
+ * @param ev the event to be handled
+ */
+ private void processEvent(Sim_event ev) {
+
+ // handle an internal event
+ double currentTime = GridSim.clock();
+
+ // Internal Event if the event source is this entity
+ if(ev.get_src() == myId_) {
+ // time to update the schedule, finish gridlets,
+ // finish reservations, start reservations and start gridlets
+ if (ev.get_tag() == UPDATE_SCHEDULE_TAG) {
+ if(currentTime > lastScheduleUpdate_) {
+ updateSchedule();
+ }
+ lastScheduleUpdate_ = currentTime;
+ }
+ else
+ processOtherEvent(ev);
+ }
+ else
+ processOtherEvent(ev);
+ }
+
/**
* Allocates a Gridlet into free PEs, sets the Gridlet status to INEXEC,
* updates the availability profile and the ranges currently available.
* @param sgl a SSGridlet object
- * @return <tt>true</tt> if one of the two following conditions holds true:
+ * @return <tt>true</tt> if one of the two following conditions
+ * holds true:
* <ul>
* <li> There are currently free PE to process the Gridlet and the Gridlet
- * WILL NOT execute beyond the <b>shadow time</b>. That is, it WILL NOT not
- * delay the first gridlet in the waiting queue.
+ * WILL NOT execute beyond the <b>shadow time</b>. That is, it
+ * WILL NOT delay the first gridlet in the waiting queue.
* <li> There are currently free PE to process the Gridlet, the Gridlet
- * WILL execute beyond the <b>shadow time</b> but WILL NOT use more PEs
- * than those left as <b>extra nodes<b>. That is, nodes remaining idle when
- * the first gridlet in the waiting queue starts.
- * </ul><br>
+ * WILL execute beyond the <b>shadow time</b> but WILL NOT use more
+ * PEs than those left as <b>extra nodes<b>. That is, nodes remaining
+ * idle when the first gridlet in the waiting queue starts.
+ * </ul>
+ * <br>
* The method returns <tt>false</tt> otherwise.
* @pre sgl != null
* @post $none
@@ -399,7 +424,6 @@
selected = super.selectPERangeList(reqPE, resource_.getFreePERanges());
}
else {
-
// a pointer to the last entry analysed
AvailabilityProfileEntry tailEntry = null;
@@ -475,7 +499,7 @@
// then send this event to itself to update the queues after
// this gridlet's completion time
- super.sendInternalEvent(executionTime, GRIDLET_FINISHED);
+ super.sendInternalEvent(executionTime, UPDATE_SCHEDULE_TAG);
return true;
}
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2008-02-11 23:42:40 UTC (rev 99)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2008-02-12 05:42:41 UTC (rev 100)
@@ -50,6 +50,10 @@
/** Parallel spaced-shared system using First Come First Serve (FCFS)
* algorithm, conservative backfilling and supporting advance reservations */
public static final int AR_PARALLEL_SPACE_SHARED = 12;
+
+ /** Parallel spaced-shared system using multiple
+ * queues and Easy Backfilling */
+ public static final int MULTIPLE_EASY_BACKFILLING_QUEUES = 13;
/**
* Allocates a new {@link TResourceCharacteristics} object.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|