public class SRTF<J extends SimJob,Q extends SRTF> extends AbstractPreemptiveSimQueue<J,Q>
In SRTF, the job present (and admitted to the server in view of server-access credits) with the minimum remaining service time is in service until completion. In case of a tie between a job entering the service area and the job currently in service, the job in service is not preempted. In case of a tie between multiple jobs in the service area, the jobs are served in arrival order.
This implementation admits waiting jobs to the service area (server) as soon as server-access credits are available, irrespective of their remaining (i.c., required) service time, in other words, jobs are not held in the waiting area because their required service time is larger that the remaining service time of the job currently in execution. Thus, once admitted to the service area, jobs may have to wait there until being served/executed exclusively by the (single) server.
Jobs are, however, admitted to the service area in increasing order of required service time. In case of a tie, jobs are admitted in order of arrival. (This is only relevant to the case of the grant of limited server-access credits; fewer that the number of jobs waiting.)
Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicyDEFAULT_PREEMPTION_STRATEGY, jobsBeingServed, remainingServiceTime, TOLERANCE_RSTeventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
SRTF(org.javades.jsimulation.r5.SimEventList eventList,
PreemptionStrategy preemptionStrategy)
Creates a single-server preemptive SRTF queue with infinite buffer size given an event list and preemption strategy.
|
| Modifier and Type | Method and Description |
|---|---|
SRTF<J,Q> |
getCopySimQueue()
Returns a new (preemptive)
SRTF object on the same SimEventList and the same preemption strategy. |
Object |
getQoS()
Calls super method (in order to make implementation final).
|
Class |
getQoSClass()
Calls super method (in order to make implementation final).
|
protected double |
getServiceTimeForJob(J job)
Calls super method (in order to make implementation final).
|
protected void |
insertJobInQueueUponArrival(J job,
double time)
Inserts the job at the head of an internal SRTF wait queue; maintaining non-decreasing (required) service-time ordering.
|
protected void |
insertJobInQueueUponStart(J job,
double time)
Performs sanity checks, removes the job from the internal SRTF/SJF wait queue, and administers its remaining service time.
|
boolean |
isStartArmed()
Returns
true. |
protected void |
removeJobFromQueueUponExit(J exitingJob,
double time)
Removes the job from the internal data structures (a.o., the SRTF/SJF wait queue)
and removes its departure event, if needed.
|
protected void |
rescheduleAfterArrival(J job,
double time)
Starts the arrived job if server-access credits are available.
|
protected void |
rescheduleAfterExit(double time)
If there are jobs in the service area but none in execution,
starts a service-chunk for the job in the service area
with the minimum remaining service time.
|
protected void |
rescheduleAfterStart(J job,
double time)
Schedules the started job for immediate execution if it is the only job in the service area
or if its (remaining) service time is strictly smaller than the remaining service of a job in execution,
the latter of which is then preempted.
|
protected void |
rescheduleForNewServerAccessCredits(double time)
Starts jobs in increasing service-time ordering as long as there are server-access credits and jobs waiting.
|
protected void |
resetEntitySubClass()
Calls super method and clears the internal SRTF queue.
|
protected void |
setServerAccessCreditsSubClass()
Calls super method (in order to make implementation final).
|
String |
toStringDefault()
Returns "SRTF[preemption strategy]".
|
getJobsBeingServed, getPreemptionStrategy, preemptJob, queueAccessVacationDropSubClass, removeJobFromQueueUponDeparture, removeJobFromQueueUponDrop, removeJobFromQueueUponRevokation, rescheduleAfterDeparture, rescheduleAfterDrop, rescheduleAfterRevokation, startServiceChunk, updateRemainingServiceTimegetBufferSize, getNumberOfServersarrive, autoRevoke, cancelDepartureEvent, cancelDepartureEvent, depart, departureFromEventList, drop, getAutoRevocationPolicy, getDepartureEvents, getDepartureEvents, getFirstJob, getFirstJobInServiceArea, getFirstJobInWaitingArea, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, hasJobs, hasJobsInServiceArea, hasJobsInWaitingArea, hasServerAcccessCredits, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, registerStdOutSimQueueListener, revoke, revoke, scheduleDepartureEvent, scheduleJobArrival, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCredits, start, takeServerAccessCredit, triggerPotentialNewStartArmed, unregisterStdOutSimQueueListeneraddPendingNotification, addPendingNotification, clearAndUnlockPendingNotificationsIfLocked, delegateOperation, doAfterNotifications, doOperation, fireAndLockPendingNotifications, getEventList, getLastUpdateTime, getRegisteredDelegatedOperations, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, notifyEventListReset, registerDelegatedOperation, registerNotificationType, registerOperation, registerPreEventHook, registerPreNotificationHook, registerPreUpdateHook, registerSimEntityListener, registerStdOutSimEntityListener, removeDelegationForOperation, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, toString, unregisterSimEntityListener, unregisterStdOutSimEntityListener, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitarrive, getAutoRevocationPolicy, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, revoke, revoke, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCreditsdoAfterNotifications, doOperation, getEventList, getLastUpdateTime, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, registerSimEntityListener, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, unregisterSimEntityListener, updatepublic SRTF(org.javades.jsimulation.r5.SimEventList eventList,
PreemptionStrategy preemptionStrategy)
eventList - The event list to use.preemptionStrategy - The preemption strategy, if null, the default is used (preemptive-resume).IllegalArgumentException - If the event list is null.public SRTF<J,Q> getCopySimQueue()
SRTF object on the same SimEventList and the same preemption strategy.SRTF object on the same SimEventList and the same preemption strategy.AbstractSimEntity.getEventList(),
AbstractPreemptiveSimQueue.getPreemptionStrategy()public String toStringDefault()
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends SRTF>SimEntity.setName(java.lang.String),
Object.toString()public final Class getQoSClass()
null.public final Object getQoS()
null.protected final void resetEntitySubClass()
resetEntitySubClass in class AbstractPreemptiveSimQueue<J extends SimJob,Q extends SRTF>AbstractPreemptiveSimQueue.remainingServiceTime,
AbstractPreemptiveSimQueue.jobsBeingServedprotected final void insertJobInQueueUponArrival(J job, double time)
In case of ties, jobs are inserted in order of arrival.
insertJobInQueueUponArrival in class AbstractSimQueue<J extends SimJob,Q extends SRTF>job - The job that arrived.time - The current time (i.e., arrival time of the job).getServiceTimeForJob(J)protected final void rescheduleAfterArrival(J job, double time)
rescheduleAfterArrival in class AbstractSimQueue<J extends SimJob,Q extends SRTF>job - The job that arrived (and is already present in AbstractSimQueue.getJobs()).time - The current time (i.e., the arrival time of the job).AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.start(double, J)protected final void setServerAccessCreditsSubClass()
setServerAccessCreditsSubClass in class AbstractSimQueue<J extends SimJob,Q extends SRTF>AbstractSimQueue.getServerAccessCredits(),
AbstractSimQueue.setServerAccessCredits(double, int),
AbstractSimQueue.rescheduleForNewServerAccessCredits(double)protected final void rescheduleForNewServerAccessCredits(double time)
Jobs are started in increasing order of required service time through the use of an internal SRTF (SJF) wait queue. In case of a tie, jobs are admitted to the service area in order of arrival.
rescheduleForNewServerAccessCredits in class AbstractSimQueue<J extends SimJob,Q extends SRTF>time - The current time (i.e., the time at which new server-access credits became available).AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.hasJobsInWaitingArea(),
AbstractSimQueue.start(double, J)public final boolean isStartArmed()
true.SimQueueListener.notifyNewStartArmed(double, Q, boolean)protected final void insertJobInQueueUponStart(J job, double time)
insertJobInQueueUponStart in class AbstractSimQueue<J extends SimJob,Q extends SRTF>job - The job that starts.time - The current time (i.e., start time of the job).getServiceTimeForJob(J),
AbstractPreemptiveSimQueue.remainingServiceTimeprotected final void rescheduleAfterStart(J job, double time)
rescheduleAfterStart in class AbstractSimQueue<J extends SimJob,Q extends SRTF>job - The job that started (and is already present in AbstractSimQueue.getJobsInServiceArea().time - The current time (i.e., the start time of the job).AbstractPreemptiveSimQueue.remainingServiceTime,
AbstractPreemptiveSimQueue.preemptJob(double, J),
AbstractPreemptiveSimQueue.startServiceChunk(double, J)protected final double getServiceTimeForJob(J job)
getServiceTimeForJob in class AbstractSimQueue<J extends SimJob,Q extends SRTF>job - The job, non-null.protected final void removeJobFromQueueUponExit(J exitingJob, double time)
removeJobFromQueueUponExit in class AbstractPreemptiveSimQueue<J extends SimJob,Q extends SRTF>exitingJob - The job leaving.time - The (current) time.AbstractPreemptiveSimQueue.remainingServiceTime,
AbstractPreemptiveSimQueue.jobsBeingServed,
AbstractSimQueue.getDepartureEvents(),
AbstractSimQueue.cancelDepartureEvent(org.javades.jqueues.r5.entity.jq.SimJQEvent.Departure<J, Q>)protected final void rescheduleAfterExit(double time)
rescheduleAfterExit in class AbstractPreemptiveSimQueue<J extends SimJob,Q extends SRTF>time - The (current) time.AbstractPreemptiveSimQueue.remainingServiceTime,
AbstractPreemptiveSimQueue.startServiceChunk(double, J)Copyright © 2018. All rights reserved.