J - The type of SimJobs supported.Q - The type of SimQueues supported.P - The type used for QoS.public class HOL_PS<J extends SimJob,Q extends HOL_PS,P> extends AbstractEgalitarianProcessorSharingSimQueue<J,Q> implements SimQueueQoS<J,Q,P>
HOL_PS queue serves all jobs in the service area simultaneously,
equally distributing its service capacity, but only admits a single job of each QoS class to the service area.
Head-of-the-Line Processor Sharing.
The Head-of-the-Line Processor-Sharing queueing system distributes its service capacity equally among the jobs in execution. Jobs start immediately upon arrival, provided that there are server-access credits left, AND no other job with the same QoS class is present (in execution). Upon regaining server-access credits, (eligible) jobs are started in arrival order.
XXX We do not really want P to be Comparable here... Any class/interface should do, including Object. This is a design failure in the QoS structure...
AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicy| Modifier and Type | Field and Description |
|---|---|
protected Map<P,Set<J>> |
jobsQoSMap |
virtualDepartureTimeeventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
HOL_PS(org.javades.jsimulation.r5.SimEventList eventList,
Class<P> qosClass,
P defaultJobQoS)
Creates a single-server HOL-PS queue with infinite buffer size given an event list.
|
| Modifier and Type | Method and Description |
|---|---|
HOL_PS<J,Q,P> |
getCopySimQueue()
Returns a new
HOL_PS object on the same SimEventList and the same QoS structure. |
P |
getDefaultJobQoS()
Gets the default QoS value used by this queue for jobs that have
null QoS value. |
Map<P,Set<J>> |
getJobsQoSMap()
Gets the mapping QoS values onto jobs currently visiting this queue with that particular QoS value.
|
P |
getQoS()
Returns
null, since the QoS value of a queue has no meaning. |
Class<? extends P> |
getQoSClass()
Overridden in order to restrict the return type.
|
protected void |
insertJobInQueueUponArrival(J job,
double time)
Inserts the job into
jobsQoSMap. |
boolean |
isStartArmed()
Returns
true if there are no jobs in the queue. |
protected void |
removeJobFromQueueUponDrop(J job,
double time)
Throws
IllegalStateException. |
protected void |
removeJobFromQueueUponRevokation(J job,
double time,
boolean auto)
Removes the jobs from the internal data structures.
|
protected void |
rescheduleAfterArrival(J job,
double time)
Starts the arrived job if server-access credits are available and there are no other jobs present with the same QoS value.
|
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
|
protected void |
rescheduleAfterDrop(J job,
double time)
Throws
IllegalStateException. |
protected void |
rescheduleAfterRevokation(J job,
double time,
boolean auto)
Attempts to start a job of the same QoS value as the job that was revoked (or departed);
calls
AbstractEgalitarianProcessorSharingSimQueue.rescheduleDepartureEvent() if that fails. |
protected void |
rescheduleForNewServerAccessCredits(double time)
Starts jobs eligible to start in arrival order as long as there are server-access credits.
|
protected void |
resetEntitySubClass()
Calls super method and clears
jobsQoSMap. |
void |
setQoS(P qos)
Calls super method (in order to make implementation final).
|
void |
setQoSClass(Class<? extends P> qosClass)
Calls super method (in order to make implementation final).
|
protected void |
setServerAccessCreditsSubClass()
Calls super method (in order to make implementation final).
|
String |
toStringDefault()
Returns "HOL-PS".
|
getServiceTimeForJob, getVirtualTime, insertJobInQueueUponStart, removeJobFromQueueUponDeparture, rescheduleAfterStart, rescheduleDepartureEvent, updateVirtualTimequeueAccessVacationDropSubClassgetBufferSize, 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 HOL_PS(org.javades.jsimulation.r5.SimEventList eventList,
Class<P> qosClass,
P defaultJobQoS)
eventList - The event list to use.qosClass - The Java class to use for QoS behavior, non-null.defaultJobQoS - The default QoS value to use for non-QoS jobs, non-null.IllegalArgumentException - If any of the arguments is null.public HOL_PS<J,Q,P> getCopySimQueue()
HOL_PS object on the same SimEventList and the same QoS structure.getCopySimQueue in interface SimQueue<J extends SimJob,Q extends HOL_PS>getCopySimQueue in interface SimQueueQoS<J extends SimJob,Q extends HOL_PS,P>HOL_PS object on the same SimEventList and the same QoS structure.AbstractSimEntity.getEventList(),
getQoSClass(),
getDefaultJobQoS()public String toStringDefault()
toStringDefault in interface SimEntitytoStringDefault in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>SimEntity.setName(java.lang.String),
Object.toString()public final Class<? extends P> getQoSClass()
SimQueueOrJobQoS
If the SimEntity does not support QoS, null should be returned.
The default implementation returns null.
getQoSClass in interface SimQoS<J extends SimJob,Q extends HOL_PS>getQoSClass in interface SimQueueOrJobQoS<J extends SimJob,Q extends HOL_PS,P>null.public final void setQoSClass(Class<? extends P> qosClass)
setQoSClass in interface SimQueueOrJobQoS<J extends SimJob,Q extends HOL_PS,P>qosClass - The new Java class used for QoS behavior, may be null.public final P getQoS()
null, since the QoS value of a queue has no meaning.public final void setQoS(P qos)
public final P getDefaultJobQoS()
SimQueueQoSnull QoS value.getDefaultJobQoS in interface SimQueueQoS<J extends SimJob,Q extends HOL_PS,P>null QoS value.SimQoS.getQoS()public final Map<P,Set<J>> getJobsQoSMap()
SimQueueQoS
Each SimJob present returning (valid) non-null QoS value from SimQoS.getQoS()
must be in present in only that value set,
and the union of these value sets must exactly match SimQueue.getJobs().
Jobs returning null from SimQoS.getQoS() must be put in a value set corresponding to
SimQueueQoS.getDefaultJobQoS().
Note that many concrete subclasses will impose an ordering on the keys and/or on the value sets.
getJobsQoSMap in interface SimQueueQoS<J extends SimJob,Q extends HOL_PS,P>SimQueue.getJobs(),
SimQoS.getQoS(),
SimQueueQoS.getDefaultJobQoS()protected void resetEntitySubClass()
jobsQoSMap.resetEntitySubClass in class AbstractEgalitarianProcessorSharingSimQueue<J extends SimJob,Q extends HOL_PS>SimEntity.resetEntity()protected final void insertJobInQueueUponArrival(J job, double time)
jobsQoSMap.insertJobInQueueUponArrival in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>job - The job that arrived.time - The current time (i.e., arrival time of the job).AbstractSimQueue.arrive(double, J),
jobsQoSMap,
rescheduleAfterArrival(J, double)protected final void rescheduleAfterArrival(J job, double time)
rescheduleAfterArrival in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>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(),
SimQueueQoSUtils.getAndCheckJobQoS(J, Q),
jobsQoSMap,
AbstractSimQueue.start(double, J),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
insertJobInQueueUponArrival(J, double)protected final void removeJobFromQueueUponDrop(J job, double time)
IllegalStateException.removeJobFromQueueUponDrop in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>job - The job that is to be dropped.time - The current time (i.e., drop time of the job).IllegalStateException - Always, as this SimQueue does not drop jobs.AbstractSimQueue.drop(J, double)protected final void rescheduleAfterDrop(J job, double time)
IllegalStateException.rescheduleAfterDrop in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>job - The jobs that was dropped.time - The current time (i.e., drop time of the job).IllegalStateException - Always, as this SimQueue does not drop jobs.AbstractSimQueue.drop(J, double)protected final void removeJobFromQueueUponRevokation(J job, double time, boolean auto)
Core method for removing a job for both revocations and departures from AbstractEgalitarianProcessorSharingSimQueue.
Removes the job from jobsQoSMap,
and if needed AbstractEgalitarianProcessorSharingSimQueue.virtualDepartureTime.
removeJobFromQueueUponRevokation in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>job - The job that is to be revoked.time - The current time (i.e., revocation time of the job).auto - Whether or not this applies to an auto-revocation.AbstractSimQueue.revoke(double, J, boolean),
AbstractSimQueue.autoRevoke(double, J),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
jobsQoSMap,
AbstractEgalitarianProcessorSharingSimQueue.virtualDepartureTime,
rescheduleAfterRevokation(J, double, boolean)protected final void rescheduleAfterRevokation(J job, double time, boolean auto)
AbstractEgalitarianProcessorSharingSimQueue.rescheduleDepartureEvent() if that fails.
Core method for rescheduling after both revocations and departures (rescheduleAfterDeparture(J, double)).
rescheduleAfterRevokation in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>job - The jobs that was successfully revoked.time - The current time (i.e., revocation time of the job).auto - Whether or not this applies to an auto-revocation.rescheduleAfterDeparture(J, double),
SimQueueQoSUtils.getAndCheckJobQoS(J, Q),
jobsQoSMap,
AbstractSimQueue.hasServerAcccessCredits(),
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueue.start(double, J),
AbstractEgalitarianProcessorSharingSimQueue.rescheduleDepartureEvent(),
removeJobFromQueueUponRevokation(J, double, boolean)protected final void setServerAccessCreditsSubClass()
setServerAccessCreditsSubClass in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>AbstractSimQueue.getServerAccessCredits(),
AbstractSimQueue.setServerAccessCredits(double, int),
AbstractSimQueue.rescheduleForNewServerAccessCredits(double)protected final void rescheduleForNewServerAccessCredits(double time)
A job is eligible to start if it resides in the waiting area and the service area currently does not contain a (another) job with the same QoS value.
rescheduleForNewServerAccessCredits in class AbstractSimQueue<J extends SimJob,Q extends HOL_PS>time - The current time (i.e., the time at which new server-access credits became available).AbstractSimQueue.hasJobsInWaitingArea(),
AbstractSimQueue.getJobsInWaitingArea(),
SimQueueQoSUtils.getAndCheckJobQoS(J, Q),
jobsQoSMap,
AbstractSimQueue.isJobInServiceArea(org.javades.jqueues.r5.entity.jq.job.SimJob),
AbstractSimQueue.start(double, J),
AbstractSimQueue.hasServerAcccessCredits()public final boolean isStartArmed()
true if there are no jobs in the queue.isStartArmed in interface SimQueue<J extends SimJob,Q extends HOL_PS>AbstractSimQueue.getNumberOfJobs()protected final void rescheduleAfterDeparture(J departedJob, double time)
rescheduleAfterDeparture in class AbstractEgalitarianProcessorSharingSimQueue<J extends SimJob,Q extends HOL_PS>departedJob - The departed job.time - The departure (current) time.rescheduleAfterRevokation(J, double, boolean),
AbstractEgalitarianProcessorSharingSimQueue.removeJobFromQueueUponDeparture(J, double)Copyright © 2018. All rights reserved.