Class RoundRobin

java.lang.Object
jline.lang.state.RoundRobin
All Implemented Interfaces:
Serializable

public class RoundRobin extends Object implements Serializable
State-space helpers and event handler for round-robin (SchedStrategy.RR) stations: FCFS service with a finite time slice (quantum), Haverkort (1998), Sect. 6.4. Port of the MATLAB State.rrInfo, State.rrSpace and State.afterEventStationRR.

The job in service runs until its service completes or its quantum expires. On expiry it is preempted, keeps its service phase (preemptive resume) and rejoins the TAIL of the queue, while the head of the queue enters service. Every entry into service draws a fresh quantum; there is no context-switch overhead.

The station keeps the FCFS preempt-resume row [buffer | server | vars]: the buffer holds right-aligned (class, phase) pairs, 1-based, the OLDEST waiting job on the right. The node block of the vars (nvars column 2R) holds the joint counts m(r,k,q) of the class-r jobs in service in service phase k whose quantum is in phase q, at column off[r] + k*Q[r] + q (0-based) of the block.

See Also:
  • Constructor Details

    • RoundRobin

      public RoundRobin()
  • Method Details

    • isPhaseType

      public static boolean isPhaseType(Distribution d)
      True when the distribution is a renewal phase-type law with a state-space form.
    • info

      public static RoundRobin.Info info(NetworkStruct sn, int ind)
      Derived description of the RR block at node ind, or null when the node is not an RR station. Memoized on the node parameters.
    • col

      public static int col(RoundRobin.Info ri, int r, int k, int q)
      Column (0-based, inside the RR block) of m(r,k,q).
    • space

      public static Matrix space(NetworkStruct sn, int ind, Matrix space, boolean initOnly)
      Append the RR block to the rows of space, which hold the [buffer | server | modulation and routing vars] layout of the station. Each row is expanded over every split of the server counts across the quantum phases; with initOnly every job in service gets the first quantum phase it can start in.
    • afterEventStationRR

      public static Ret.EventResult afterEventStationRR(NetworkStruct sn, int ind, int ist, Matrix inspace, EventType event, int jobClass, boolean isSimulation, int R, Matrix K, Matrix lldscaling, int lldlimit, Map<Station,SerializableFunction<Matrix,Matrix>> cdscaling, int V)
      Event handler of an RR station; see the class comment for the dynamics. ARV is passive, DEP and PHASE (service phase move, quantum phase move, quantum expiry) are active.