Class Queue
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class Queue extends ServiceStation implements Serializable
A queueing station that processes jobs according to various scheduling strategies.
The Queue node is the fundamental service station in queueing networks. It models a system where jobs wait in a buffer and are processed by one or more servers according to a scheduling strategy. Common examples include CPU schedulers, disk I/O queues, network routers, and service desks.
Key features:
- Multiple scheduling strategies: FCFS, PS, LCFS, priority-based, etc.
- Single or multi-server configurations
- Load-dependent and class-dependent service rates
- Support for preemptive and non-preemptive policies
- Polling server capabilities with various polling types
- Switchover times between job classes
- Since:
1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<JobClass, Distribution>setupTimesprotected Map<JobClass, Distribution>delayOffTimesprotected List<ServiceBinding>serviceProcessesprotected intnumberOfServersprotected intcapprotected Map<JobClass, Integer>classCapprotected Map<JobClass, DropStrategy>dropRuleprotected MatrixlldScalingprotected SerializableFunction<Matrix, Double>lcdScalingprotected Map<JobClass, Map<JobClass, Distribution>>switchoverTimesprotected SchedStrategyschedStrategyprotected SchedStrategyTypeschedPolicyprotected HashMap<JobClass, Double>schedStrategyParpublic Matrixstatepublic MatrixstatePriorpublic final NodeAttributeattributepublic Networkmodelprotected InputSectioninputprotected OutputSectionoutputprotected ServiceSectionserverprotected DropStrategydropStrategyprotected intstatefulIdxprotected intnodeIndexprotected intstationIdxprotected Stringname
-
Method Summary
Modifier and Type Method Description booleancontainsJobClass(JobClass jobClass)Checks whether this queue has a service process configured for the specified job class. SchedStrategyTypegetSchedPolicy()Gets the scheduling policy type (preemptive or non-preemptive). SchedStrategygetSchedStrategy()Gets the scheduling strategy used by this queue. doublegetSchedStrategyPar(JobClass jobClass)Gets the scheduling strategy parameter for a specific job class. DistributiongetService(JobClass jobClass)Gets the service time distribution for a specific job class. voidprintSummary()Prints a summary of this queue's configuration to standard output. voidsetClassDependence(SerializableFunction<Matrix, Double> beta)Sets a class-dependent scaling function for service rates. voidsetLoadDependence(Matrix alpha)Sets load-dependent service rate scaling factors. voidsetNumberOfServers(int numberOfServers)Sets the number of servers at this queueing station. voidsetSchedStrategyPar(JobClass jobClass, double weight)Sets the scheduling strategy parameter for a specific job class. voidsetPollingType(PollingType pollingType)Sets the polling type for this queue (only valid for POLLING scheduling strategy). voidsetPollingType(PollingType pollingType, int k)Sets the polling type for this queue with K value for K-LIMITED (only valid for POLLING scheduling strategy). voidsetPollingK(int k)Sets the K value for K-LIMITED polling (only valid for POLLING scheduling strategy with K-LIMITED type). voidsetSwitchover(JobClass jobClass, Distribution switchoverTime)Sets the switchover time for a job class (only valid for POLLING scheduling strategy). voidsetSwitchover(JobClass fromClass, JobClass toClass, Distribution switchoverTime)Sets the switchover time from one job class to another (for general scheduling strategies). DistributiongetSwitchover(JobClass fromClass, JobClass toClass)Gets the switchover time from one job class to another. DistributiongetSwitchover(JobClass jobClass)Gets the switchover time for a job class (POLLING scheduling strategy). voidsetDelayOff(JobClass jobClass, Distribution setupTime, Distribution delayoffTime)Sets the setup time and delay off time for a job class. DistributiongetSetupTime(JobClass jobClass)Gets the setup time distribution for a job class. DistributiongetDelayOffTime(JobClass jobClass)Gets the delay-off time distribution for a job class. -
Methods inherited from class jline.lang.nodes.StatefulNode
clearState, getState, getStatePrior, getStateSpace, getStatefulIndex, resetStateSpace, setState, setState, setStatePrior, setStateSpace -
Methods inherited from class jline.lang.nodes.Node
getAttribute, getDropStrategy, getInput, getModel, getNodeIndex, getOutput, getOutputStrategies, getRoutingStrategy, getSections, getServer, getStatefulIdx, getStationIdx, isStateful, reset, resetRouting, setModel, setNodeIdx, setProbRouting, setRouting, setRouting, setStationIdx -
Methods inherited from class jline.lang.nodes.ServiceStation
getServiceProcess, setService, setService -
Methods inherited from class jline.lang.nodes.Station
getCap, getClassCap, getDropRule, getLimitedClassDependence, getLimitedLoadDependence, getNumberOfServers, getServiceRates, getSourceRates, getSwitchoverTime, hasSwitchoverTime, isReferenceStation, isServiceDefined, isServiceDefined, isServiceDisabled, isServiceDisabled, setCapacity, setChainCapacity, setClassCap, setDropRule, setLimitedClassDependence, setLimitedLoadDependence, setSwitchoverTime -
Methods inherited from class jline.lang.Element
getName, setName -
Methods inherited from class jline.lang.Copyable
copy -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Queue
Queue(Network model, String name, SchedStrategy schedStrategy)
Creates a new queueing station with the specified scheduling strategy.- Parameters:
model- the network model to add this queue toname- the name for this queueing stationschedStrategy- the scheduling strategy to use (e.g.
-
-
Method Detail
-
containsJobClass
boolean containsJobClass(JobClass jobClass)
Checks whether this queue has a service process configured for the specified job class.
- Parameters:
jobClass- The job class to check- Returns:
true if a service process exists for this job class, false otherwise
-
getSchedPolicy
SchedStrategyType getSchedPolicy()
Gets the scheduling policy type (preemptive or non-preemptive).
- Returns:
The scheduling policy type (PR for preemptive, NP for non-preemptive)
-
getSchedStrategy
SchedStrategy getSchedStrategy()
Gets the scheduling strategy used by this queue.
- Returns:
The scheduling strategy (e.g., FCFS, PS, LCFS, etc.)
-
getSchedStrategyPar
double getSchedStrategyPar(JobClass jobClass)
Gets the scheduling strategy parameter for a specific job class.
For strategies like DPS (Discriminatory Processor Sharing) and GPS (Generalized Processor Sharing), this returns the weight or priority parameter for the job class.
- Parameters:
jobClass- The job class to get the parameter for- Returns:
The scheduling parameter value, or 0.0 if not set
-
getService
Distribution getService(JobClass jobClass)
Gets the service time distribution for a specific job class.
- Parameters:
jobClass- The job class to get the service distribution for- Returns:
The service time distribution for this job class
-
printSummary
void printSummary()
Prints a summary of this queue's configuration to standard output.
The summary includes the queue name, service processes for each job class, their mean service times and squared coefficients of variation, number of servers, and output routing configuration.
-
setClassDependence
void setClassDependence(SerializableFunction<Matrix, Double> beta)
Sets a class-dependent scaling function for service rates.
The function takes a matrix representing the number of jobs of each class at the station and returns a scaling factor for the service rate. This enables modeling of systems where service rates depend on the job mix.
- Parameters:
beta- A function that maps job class populations to a service rate scaling factor
-
setLoadDependence
void setLoadDependence(Matrix alpha)
Sets load-dependent service rate scaling factors.
Each element alpha[n] specifies the service rate scaling when there are n jobs at the station. This enables modeling of systems where performance degrades under load.
- Parameters:
alpha- A matrix of scaling factors indexed by the number of jobs
-
setNumberOfServers
void setNumberOfServers(int numberOfServers)
Sets the number of servers at this queueing station.
For infinite server (IS) queues, this method has no effect as they always have unlimited servers.
- Parameters:
numberOfServers- The number of parallel servers (must be positive)
-
setSchedStrategyPar
void setSchedStrategyPar(JobClass jobClass, double weight)
Sets the scheduling strategy parameter for a specific job class.
For weighted scheduling strategies (DPS, GPS, etc.), this sets the weight or priority parameter that determines the job class's share of the service capacity.
- Parameters:
jobClass- The job class to set the parameter forweight- The scheduling parameter value (e.g.
-
setPollingType
void setPollingType(PollingType pollingType)
Sets the polling type for this queue (only valid for POLLING scheduling strategy).
- Parameters:
pollingType- the polling type (GATED, EXHAUSTIVE, or KLIMITED)
-
setPollingType
void setPollingType(PollingType pollingType, int k)
Sets the polling type for this queue with K value for K-LIMITED (only valid for POLLING scheduling strategy).
- Parameters:
pollingType- the polling type (GATED, EXHAUSTIVE, or KLIMITED)k- the K value for K-LIMITED polling (ignored for other types)
-
setPollingK
void setPollingK(int k)
Sets the K value for K-LIMITED polling (only valid for POLLING scheduling strategy with K-LIMITED type).
- Parameters:
k- the K value (must be greater than 0)
-
setSwitchover
void setSwitchover(JobClass jobClass, Distribution switchoverTime)
Sets the switchover time for a job class (only valid for POLLING scheduling strategy).
- Parameters:
jobClass- the job classswitchoverTime- the switchover time distribution
-
setSwitchover
void setSwitchover(JobClass fromClass, JobClass toClass, Distribution switchoverTime)
Sets the switchover time from one job class to another (for general scheduling strategies).
- Parameters:
fromClass- the job class to switch fromtoClass- the job class to switch toswitchoverTime- the switchover time distribution
-
getSwitchover
Distribution getSwitchover(JobClass fromClass, JobClass toClass)
Gets the switchover time from one job class to another.
- Parameters:
fromClass- the job class to switch fromtoClass- the job class to switch to- Returns:
the switchover time distribution, or null if not set
-
getSwitchover
Distribution getSwitchover(JobClass jobClass)
Gets the switchover time for a job class (POLLING scheduling strategy).
- Parameters:
jobClass- the job class- Returns:
the switchover time distribution, or null if not set
-
setDelayOff
void setDelayOff(JobClass jobClass, Distribution setupTime, Distribution delayoffTime)
Sets the setup time and delay off time for a job class. This is typically used for function-based tasks that have initialization overhead.
- Parameters:
jobClass- the job classsetupTime- the setup time distributiondelayoffTime- the delay off time distribution
-
getSetupTime
Distribution getSetupTime(JobClass jobClass)
Gets the setup time distribution for a job class.
- Parameters:
jobClass- the job class- Returns:
the setup time distribution, or null if not set
-
getDelayOffTime
Distribution getDelayOffTime(JobClass jobClass)
Gets the delay-off time distribution for a job class.
- Parameters:
jobClass- the job class- Returns:
the delay-off time distribution, or null if not set
-
-
-
-