public abstract class AbstractEgalitarianProcessorSharingSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue> extends AbstractProcessorSharingSimQueue<J,Q> implements SimQueue<J,Q>
In egalitarian processor-sharing queueing disciplines, all jobs in the service area are served simultaneously at equal rates, until completion of one of them. The service rate, naturally, is inversely proportional to the number of jobs in the service area.
The remaining degrees of freedom to sub-classes are when to start which jobs.
AbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimQueue.AutoRevocationPolicySimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicy| Modifier and Type | Field and Description |
|---|---|
protected HashMapWithPreImageAndOrderedValueSet<J,Double> |
virtualDepartureTime
The mapping from jobs in
AbstractSimQueue.getJobsInServiceArea() to their respective virtual departure times. |
eventsScheduled, SANITYUSE_ARRAY_OPTIMIZATION| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEgalitarianProcessorSharingSimQueue(org.javades.jsimulation.r5.SimEventList eventList,
int bufferSize,
int numberOfServers)
Creates a egalitarian processor-sharing queue given an event list, buffer size and number of servers.
|
| Modifier and Type | Method and Description |
|---|---|
protected double |
getServiceTimeForJob(J job)
Calls super method (in order to make implementation final).
|
protected double |
getVirtualTime()
Returns the current virtual time.
|
protected void |
insertJobInQueueUponStart(J job,
double time)
Performs sanity checks, and administers the job's virtual departure time.
|
protected void |
removeJobFromQueueUponDeparture(J departingJob,
double time)
Calls
AbstractSimQueue.removeJobFromQueueUponRevokation(J, double, boolean) for the departed job. |
protected void |
rescheduleAfterDeparture(J departedJob,
double time)
Calls
rescheduleDepartureEvent(). |
protected void |
rescheduleAfterStart(J job,
double time)
Reschedules due to the start of a job.
|
protected void |
rescheduleDepartureEvent()
Reschedules the single departure event for this queue.
|
protected void |
resetEntitySubClass()
Calls super method, resets the virtual time to zero and clears the virtual departure time map.
|
protected void |
updateVirtualTime(double newTime)
Updates the virtual time.
|
queueAccessVacationDropSubClassgetBufferSize, getNumberOfServersarrive, autoRevoke, cancelDepartureEvent, cancelDepartureEvent, depart, departureFromEventList, drop, getAutoRevocationPolicy, getDepartureEvents, getDepartureEvents, getFirstJob, getFirstJobInServiceArea, getFirstJobInWaitingArea, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, hasJobs, hasJobsInServiceArea, hasJobsInWaitingArea, hasServerAcccessCredits, insertJobInQueueUponArrival, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, registerStdOutSimQueueListener, removeJobFromQueueUponDrop, removeJobFromQueueUponRevokation, rescheduleAfterArrival, rescheduleAfterDrop, rescheduleAfterRevokation, rescheduleForNewServerAccessCredits, revoke, revoke, scheduleDepartureEvent, scheduleJobArrival, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCredits, setServerAccessCreditsSubClass, start, takeServerAccessCredit, toStringDefault, 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, getCopySimQueue, getJobs, getJobsInServiceArea, getJobsInWaitingArea, getNumberOfJobs, getNumberOfJobsInServiceArea, getNumberOfJobsInWaitingArea, getServerAccessCredits, isJob, isJobInServiceArea, isJobInWaitingArea, isQueueAccessVacation, isStartArmed, revoke, revoke, setAutoRevocationPolicy, setQueueAccessVacation, setServerAccessCreditsdoAfterNotifications, doOperation, getEventList, getLastUpdateTime, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, registerSimEntityListener, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, toStringDefault, unregisterSimEntityListener, updatenotifyEventListResetgetQoS, getQoSClassprotected final HashMapWithPreImageAndOrderedValueSet<J extends SimJob,Double> virtualDepartureTime
AbstractSimQueue.getJobsInServiceArea() to their respective virtual departure times.
The special extensions to TreeMap allow for efficient determination of the pre-images of
virtual departure times.
protected AbstractEgalitarianProcessorSharingSimQueue(org.javades.jsimulation.r5.SimEventList eventList,
int bufferSize,
int numberOfServers)
The constructor registers a pre-update hook that sets the virtual time upon updates.
eventList - The event list to use.bufferSize - The buffer size (non-negative), Integer.MAX_VALUE is interpreted as infinity.numberOfServers - The number of servers (non-negative), Integer.MAX_VALUE is interpreted as infinity.AbstractSimEntity.registerPreUpdateHook(java.util.function.DoubleConsumer),
updateVirtualTime(double)protected final double getVirtualTime()
The virtual time for an AbstractEgalitarianProcessorSharingSimQueue
is zero when no jobs are being executed, and increases in time inversely proportional to the number of jobs in execution.
Hence, if there is only one job in execution, the virtual time increases at the same rate as the ("real") time,
but if N > 1 jobs are being executed, the virtual time increases linearly with slope 1/N in time.
The virtual time is kept consistent in AbstractSimEntity.update(double).
Note that with an AbstractEgalitarianProcessorSharingSimQueue,
the virtual departure time of a job can be calculated at the time the job is taken into service;
it does not change afterwards
(as the required service time cannot change during a queue visit, by contract of SimQueue).
AbstractSimEntity.update(double)protected void resetEntitySubClass()
resetEntitySubClass in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>SimEntity.resetEntity()protected final void updateVirtualTime(double newTime)
This method is called as an update hook, and not meant to be called from user code (in sub-classes).
It is left protected for javadoc.
newTime - The new time.AbstractSimQueue.getNumberOfJobsInServiceArea(),
getVirtualTime(),
AbstractSimEntity.getLastUpdateTime(),
AbstractSimEntity.registerPreUpdateHook(java.util.function.DoubleConsumer)protected final void insertJobInQueueUponStart(J job, double time)
insertJobInQueueUponStart in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>job - The job that starts.time - The current time (i.e., start time of the job).getServiceTimeForJob(J),
getVirtualTime(),
virtualDepartureTimeprotected final void rescheduleAfterStart(J job, double time)
rescheduleAfterStart in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>job - The job that started (and is already present in AbstractSimQueue.getJobsInServiceArea().time - The current time (i.e., the start time of the job).virtualDepartureTime,
getServiceTimeForJob(J),
rescheduleDepartureEvent(),
AbstractSimQueue.depart(double, J)protected final double getServiceTimeForJob(J job)
getServiceTimeForJob in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>job - The job, non-null.protected final void removeJobFromQueueUponDeparture(J departingJob, double time)
AbstractSimQueue.removeJobFromQueueUponRevokation(J, double, boolean) for the departed job.removeJobFromQueueUponDeparture in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>departingJob - The job that departs.time - The departure (current) time.AbstractSimQueue.removeJobFromQueueUponRevokation(J, double, boolean),
rescheduleAfterDeparture(J, double)protected void rescheduleAfterDeparture(J departedJob, double time)
rescheduleDepartureEvent().
May be overridden/augmented by sub-classes
if additional actions/checks are required upon a departure (e.g., in HOL_PS.
rescheduleAfterDeparture in class AbstractSimQueue<J extends SimJob,Q extends AbstractEgalitarianProcessorSharingSimQueue>departedJob - The departed job.time - The departure (current) time.rescheduleDepartureEvent(),
removeJobFromQueueUponDeparture(J, double)protected final void rescheduleDepartureEvent()
First, cancels a pending departure event.
Then, determines which job in the service area (if any) is to depart first through virtualDepartureTime,
and what its remaining service time is.
AbstractSimEntity.getLastUpdateTime(),
AbstractSimQueue.getDepartureEvents(),
AbstractSimQueue.cancelDepartureEvent(org.javades.jqueues.r5.entity.jq.SimJQEvent.Departure<J, Q>),
AbstractSimQueue.getJobsInServiceArea(),
virtualDepartureTime,
getVirtualTime(),
AbstractSimQueue.depart(double, J),
AbstractSimQueue.scheduleDepartureEvent(double, J)Copyright © 2018. All rights reserved.