|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Thread Sim_entity AllocPolicy ConservativeBackfill
public class ConservativeBackfill
ConservativeBackfill
class is an allocation policy for
ParallelResource
that implements conservative backfilling.
The policy is based on the conservative backfilling algorithm
described in the following papers:
To illustrate how the availability profile works, imagine that the simulation has just started and the availability profile is empty. The grid resource has 500 PEs. Therefore, the range of PEs available is [0..499]. At simulation time 100, a job (Ja) arrives requiring 100 PEs. The job is expected to execute for 500 seconds. As the resource is not executing any jobs, Ja is accepted and given the range [0..99]. The ranges of current PEs available is updated to [100..499] and one entry is inserted at the profile to indicate that the range [0..499] will be available again at simulation time 600 seconds.
Now suppose that a job (Jb) arrives at simulation time 200 requiring 400 PEs and expected to run for 500 seconds. The policy checks the ranges currently available and find [100..499]. It then scans the availability profile and analyses all the entries whose time is smaller than the expected termination time of Jb. The policy finds the intersections of PEs amongst the entries, process similar to finding intersections of sequences. While scanning the profile, the policy finds the entry at 600 seconds. The intersection of [100..499] and [0..499] is [100..499]. That means that there are enough resources to schedule Jb and then Jb starts the execution. The policy then updates the ranges of current PEs to []. After that, the policy updates the entry at 600 seconds to [0..99] and inserts an entry with time 700 seconds with the range [0..499].
Now consider that a third job (Jc) arrives at simulation time 250 requiring 500 PEs and expected to run for 100 seconds. As the current ranges available is [], the policy scans the profile until it finds an entry with enough PEs available. In this case, the entry found is at 700 seconds. The policy would continue scanning the profile finding the intersection with other ranges if there were more. In this case, 700 seconds is the last entry in the profile. The job is then set to start execution at time 700 seconds. The policy then updates the entry at time 700 seconds to [] and creates an entry at 800 with [0..499]. Jc is then put in the waiting queue.
NOTE THAT:
WorkloadLublin99
.
GridSim
,
ResourceCharacteristics
,
AllocPolicy
,
PERange
,
PERangeList
Nested Class Summary |
---|
Nested classes/interfaces inherited from class Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected ResourceDynamics |
dynamics
|
protected Comparator<SSGridlet> |
jobOrder
|
protected SingleProfile |
profile
|
protected int |
ratingPE
|
protected SSGridletList |
runningJobs
|
protected static int |
UPT_SCHEDULE
|
protected SSGridletList |
waitingJobs
|
Fields inherited from class AllocPolicy |
---|
initTime_, myId_, outputPort_, resCalendar_, resId_, resName_, resource_, totalPE_ |
Fields inherited from class Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ConservativeBackfill(String resourceName,
String entityName)
Allocates a new ConservativeBackfill object. |
Method Summary | |
---|---|
void |
body()
Handles internal events that come to this entity. |
protected boolean |
compressSchedule(double refTime,
boolean execute)
This method performs the compression of the schedule. |
protected void |
enqueueGridlet(SSGridlet sgl)
Enqueues a gridlet. |
protected int |
finishRunningGridlets()
This method finalises the jobs that have completed |
protected long |
forecastExecutionTime(double availableRating,
double length)
Forecast finish time of a Gridlet. |
void |
gridletCancel(int gridletId,
int userId)
Cancels a job running or in the waiting queue. |
protected void |
gridletFinish(SSGridlet sgl,
int status)
Updates the Gridlet's properties, such as status once a Gridlet is considered finished. |
void |
gridletMove(int gridletId,
int userId,
int destId,
boolean ack)
An abstract method that moves a Gridlet to another GridResource entity. |
void |
gridletPause(int gridletId,
int userId,
boolean ack)
An abstract method that pauses a Gridlet during an execution. |
void |
gridletResume(int gridletId,
int userId,
boolean ack)
An abstract method that resumes a previously paused Gridlet. |
int |
gridletStatus(int gridletId,
int userId)
Finds the status of a specified job |
void |
gridletSubmit(Gridlet gridlet,
boolean ack)
Schedules a new job received by the Grid resource entity. |
boolean |
setJobOrderingHeuristic(Comparator<SSGridlet> comparator)
Sets the heuristic used to order the jobs considered for backfilling or when a cancellation takes place |
protected boolean |
startGridlet(SSGridlet sgl)
Allocates a job into free PEs, sets the job status to INEXEC, |
protected int |
startQueuedGridlets()
This method starts jobs that are in the queue and can be started |
protected void |
updateSchedule()
This method is called to update the schedule. |
Methods inherited from class AllocPolicy |
---|
addTotalLoad, calculateTotalLoad, findGridlet, getTotalLoad, gridletMigrate, init, isEndSimulation, processOtherEvent, sendAck, sendCancelGridlet, sendFinishGridlet, sendInternalEvent, sendInternalEvent, setEndSimulation |
Methods inherited from class Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SSGridletList waitingJobs
protected SSGridletList runningJobs
protected SingleProfile profile
protected int ratingPE
protected Comparator<SSGridlet> jobOrder
protected ResourceDynamics dynamics
protected static final int UPT_SCHEDULE
Constructor Detail |
---|
public ConservativeBackfill(String resourceName, String entityName) throws Exception
ConservativeBackfill
object.
resourceName
- the grid resource entity name that will contain
this allocation policyentityName
- this object entity name
Exception
- This happens when one of the following scenarios occur:
null
or empty
Method Detail |
---|
public void body()
body
in class Sim_entity
public boolean setJobOrderingHeuristic(Comparator<SSGridlet> comparator)
comparator
- a comparator implementation.
true
if the heuristic was set correctly.public void gridletSubmit(Gridlet gridlet, boolean ack)
gridletSubmit
in class AllocPolicy
gridlet
- a Gridlet object to be executedack
- an acknowledgement, i.e. true
if wanted to know
whether this operation is successful or not;
false
otherwise (don't care)ResGridlet
,
ResGridletList
public int gridletStatus(int gridletId, int userId)
gridletStatus
in class AllocPolicy
gridletId
- a job IDuserId
- the user or owner's ID of this job
-1
if not foundGridlet
public void gridletCancel(int gridletId, int userId)
null
job will be send back to sender.
gridletCancel
in class AllocPolicy
gridletId
- a job IDuserId
- the user or owner's ID of this jobpublic void gridletMove(int gridletId, int userId, int destId, boolean ack)
AllocPolicy
AllocPolicy.sendAck(int, boolean, int, int)
.AllocPolicy.sendAck(int, boolean, int, int)
. AllocPolicy.sendFinishGridlet(Gridlet)
.AllocPolicy.gridletMigrate(Gridlet, int, boolean)
.
gridletMove
in class AllocPolicy
gridletId
- a Gridlet IDuserId
- the user or owner's ID of this GridletdestId
- a new destination GridResource ID for this Gridletack
- an acknowledgement, i.e. true if wanted to know
whether this operation is success or not, false
otherwise (don't care)public void gridletPause(int gridletId, int userId, boolean ack)
AllocPolicy
If an acknowledgement is required, then at the end of this method,
should include the following code:
... // other code
// sends back an ack if required
boolean success = true; // If this method success, false otherwise
if (ack == true) {
sendAck(GridSimTags.GRIDLET_PAUSE_ACK,
success, gl.getGridletID(), gl.getUserID() );
}
gridletPause
in class AllocPolicy
gridletId
- a Gridlet IDuserId
- the user or owner's ID of this Gridletack
- an acknowledgement, i.e. true if wanted to know
whether this operation is success or not, false
otherwise (don't care)public void gridletResume(int gridletId, int userId, boolean ack)
AllocPolicy
If an acknowledgement is required, then at the end of this method,
should include the following code:
... // other code
// sends back an ack if required
boolean success = true; // If this method success, false otherwise
if (ack == true) {
sendAck(GridSimTags.GRIDLET_RESUME_ACK,
success, gl.getGridletID(), gl.getUserID() );
}
gridletResume
in class AllocPolicy
gridletId
- a Gridlet IDuserId
- the user or owner's ID of this Gridletack
- an acknowledgement, i.e. true if wanted to know
whether this operation is success or not, false
otherwise (don't care)protected boolean compressSchedule(double refTime, boolean execute)
refTime
- jobs whose start time is larger than refTime may be shiftedexecute
- true
means that the job cancelled was running,
so this method will try to start waiting jobs. If not possible they are
reinserted in the waiting queue with the new start time.
true
if the job has been updated.protected int finishRunningGridlets()
protected int startQueuedGridlets()
protected void updateSchedule()
protected boolean startGridlet(SSGridlet sgl)
sgl
- a SSGridlet object
true
if there is are free PE to process this job,
false
otherwiseprotected void enqueueGridlet(SSGridlet sgl)
sgl
- the resource gridletprotected long forecastExecutionTime(double availableRating, double length)
availableRating
- the shared MIPS rating for all Gridletslength
- remaining Gridlet length
protected void gridletFinish(SSGridlet sgl, int status)
sgl
- a SSGridlet objectstatus
- the Gridlet status
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |