|
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 AggressiveMultiPartitions
public class AggressiveMultiPartitions
This class implements a non-FCFS policy to schedule parallel jobs. The
policy is based on aggressive (EASY) backfilling. This policy can use
multiple partitions or queues and the jobs can be directed to these partitions
using a partition predicate (PartitionPredicate
. A partition
can borrow resources from another when it requires and the resources are
not being used by the other partition. However, you can change this behaviour
by calling setAllowBorrowing(boolean)
. Additionally, this policy
supports priorities. Jobs are ordered according to their priorities;
a high priority job can take the place of a pivot with lower priority.
To change the way that the scheduler assigns priorities to the jobs, please
see PrioritySelector
. The implementation of this policy is based
on the following paper:
NOTE THAT:
WorkloadLublin99
.
AllocPolicy
,
ParallelResource
Nested Class Summary | |
---|---|
(package private) class |
AggressiveMultiPartitions.EasyBackFillingPartition
|
(package private) class |
AggressiveMultiPartitions.OrderGridletsByPriority
|
Nested classes/interfaces inherited from class Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected boolean |
allowBorrowing
|
protected ResourceDynamics |
dynamics
|
protected Comparator<SSGridlet> |
jobOrder
|
protected PrioritySelector |
prioritySelector
|
protected PartProfile |
profile
|
protected int |
ratingPE
|
protected boolean |
returnJob
|
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 | |
---|---|
AggressiveMultiPartitions(String resourceName,
String entityName,
int numPartitions)
Allocates a new object. |
Method Summary | |
---|---|
protected int |
backfillGridlets()
This method starts/backfills jobs that are in the queue and pivots (first jobs in the partitions) whose start time is smaller than the current simulation time. |
void |
body()
Handles internal events that come to this entity. |
boolean |
createPartition(int partId,
int numPE,
PartitionPredicate predicate)
Creates a new partition in this scheduler. |
protected int |
finishRunningGridlets()
This method finalises the jobs in execution whose time is smaller or equals to the current simulation time. |
protected long |
forecastExecutionTime(double availableRating,
double length)
Forecast finish time of a job. |
void |
gridletCancel(int gridletId,
int userId)
Cancels a job running or in the waiting queue. |
protected void |
gridletFinish(SSGridlet sgl,
int status)
Updates the job's properties once a job 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/adds to the queue a new job received by the resource entity. |
protected boolean |
scheduleGridlet(SSGridlet sgl)
Tries to schedule a job. |
void |
setAllowBorrowing(boolean allow)
Indicates whether the borrowing of resources of the partitions from one another is allowed or not. |
boolean |
setJobOrderingHeuristic(Comparator<SSGridlet> comparator)
Sets the heuristic used to order the jobs considered for backfilling |
boolean |
setPrioritySelector(PrioritySelector selector)
Sets the priority selector to be used by this scheduler. |
void |
setReturnGridletBehaviour(boolean returnJob)
This method is called to specify the behaviour of the policy if a job cannot be scheduled to its partition due to the lack of enough resources and the borrowing is disabled. |
protected boolean |
startGridlet(SSGridlet sgl)
Tries to start a job. |
protected void |
updateSchedule()
This method is called to update the schedule. |
protected boolean |
validateGridlet(SSGridlet sgl)
Checks whether the job can be handled by the resource. |
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 int ratingPE
protected PartProfile profile
protected Comparator<SSGridlet> jobOrder
protected ResourceDynamics dynamics
protected PrioritySelector prioritySelector
protected boolean allowBorrowing
protected boolean returnJob
protected static final int UPT_SCHEDULE
Constructor Detail |
---|
public AggressiveMultiPartitions(String resourceName, String entityName, int numPartitions) throws Exception
resourceName
- the resource entity name that will
contain this allocation policyentityName
- this object entity namenumPartitions
- The number of partitions of the scheduling queue
IllegalArgumentException
- if number of partitions is <= 0
Exception
- This happens when one of the following scenarios occur:
null
or empty
zero
number of PEs (Processing
Elements). Method Detail |
---|
public boolean createPartition(int partId, int numPE, PartitionPredicate predicate)
partId
- the id of the partitionnumPE
- the number of PEs in this partitionpredicate
- the predicate to be used to select
jobs for this partition.
true
if the partition has been set
correctly; false
otherwise.
IllegalArgumentException
- if the number of PEs is
<= 0
or you provide an invalid predicate.
IndexOutOfBoundsException
- if you provide an invalid partition idpublic boolean setJobOrderingHeuristic(Comparator<SSGridlet> comparator)
comparator
- a comparator implementation that defines
how jobs are ordered.
true
if the heuristic was set correctly;
false
otherwise.public void setAllowBorrowing(boolean allow)
allow
- true
indicates that it is allowed;
false
otherwise.public void setReturnGridletBehaviour(boolean returnJob)
true
value is passed to this
method, it indicates that a job should be returned to the user
immediately if it could not be scheduled to its corresponding partition
and the borrowing of resources from other partitions is disabled. That is,
if a job arrives at the resource, the partition does not have enough
resources, borrowing is disabled and the returnGridlet behaviour is true,
the job will be returned to the user entity. This prevents the policy
from queueing job even if it will never be able to serve them.
A user may want to change this behaviour if he wants to implement manual
borrowing or resizing of the resource partitions. In such a case, the
job will be queued even if they cannot be handled by its partition
at the time of arrival.
returnJob
- true
indicates that the job should be
returned; false
otherwise.public boolean setPrioritySelector(PrioritySelector selector)
selector
- the selector to be used.
true
if the selector has been defined successfully or
false
otherwise.public void body()
body
in class Sim_entity
public void gridletSubmit(Gridlet gridlet, boolean ack)
gridletSubmit
in class AllocPolicy
gridlet
- a job 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)
userId
.
null
Gridlet will be send back
to sender, i.e. the userId
.
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 validateGridlet(SSGridlet sgl)
sgl
- the server side gridlet to be examined
true
if it can be handled; false
otherwise.protected boolean startGridlet(SSGridlet sgl)
sgl
- the job to be started
true
if the job has been startedprotected boolean scheduleGridlet(SSGridlet sgl)
null
sgl
- the resource job
true
if the job was scheduled.protected void updateSchedule()
protected int finishRunningGridlets()
protected int backfillGridlets()
protected long forecastExecutionTime(double availableRating, double length)
availableRating
- the shared MIPS rating for all jobslength
- remaining job length
protected void gridletFinish(SSGridlet sgl, int status)
sgl
- a SSGridlet objectstatus
- the job status
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |