/// <inheritdoc/> internal override bool GetNextDelay(IEnumerable <ControlledOperation> ops, ControlledOperation current, int maxValue, out int next) { next = this.RandomValueGenerator.Next(maxValue); this.StepCount++; return(true); }
/// <inheritdoc/> internal override bool GetNextIntegerChoice(ControlledOperation current, int maxValue, out int next) { if (this.IsFair) { this.SpecificationEngine?.CheckLivenessThresholdExceeded(); } return(this.SchedulingStrategy.GetNextIntegerChoice(current, maxValue, out next)); }
/// <inheritdoc/> internal override bool GetNextOperation(IEnumerable <ControlledOperation> ops, ControlledOperation current, bool isYielding, out ControlledOperation next) { if (this.IsFair) { this.SpecificationEngine?.CheckLivenessThresholdExceeded(); } return(this.SchedulingStrategy.GetNextOperation(ops, current, isYielding, out next)); }
/// <inheritdoc/> internal override bool GetNextDelay(IEnumerable <ControlledOperation> ops, ControlledOperation current, int maxValue, out int next) { Guid id = this.GetOperationId(); this.StepCount++; // Reshuffle the probabilities after every (this.MaxSteps / this.PriorityChangePoints) steps. if (this.StepCount % (this.MaxSteps / this.PriorityChangePoints) == 0) { this.LowPrioritySet.Clear(); this.HighPrioritySet.Clear(); } // If this task is not assigned to any priority set, then randomly assign it to one of the two sets. if (!this.LowPrioritySet.Contains(id) && !this.HighPrioritySet.Contains(id)) { if (this.RandomValueGenerator.NextDouble() < this.LowPriorityProbability) { this.LowPrioritySet.Add(id); } else { this.HighPrioritySet.Add(id); } } // Choose a random delay if this task is in the low priority set. if (this.LowPrioritySet.Contains(id)) { next = this.RandomValueGenerator.Next(maxValue) * 5; } else { next = 0; } return(true); }