# Sequence Step Algorithm in Operating System

A **Discrete Event Simulation** models operation of a system as a series of events in time. Each event occurs at a particular instant in time and between these instances the system is assumed to be unchanged.

The **Sequence Step Algorithm** is implemented in a discrete event simulation system to maximize resource utilization. It allows development of resource-based simulation models for scheduling repetitive projects with probabilistic activity duration while maintaining continuous resource utilization.

To put it in simpler words, let us assume construction of a multistory building. On each floor same work is to be done, for example, consider painting 10th floor, for these walls of 10th floors should be built and painting crew should have done painting 9th floor. Now if for some reason crew finished painting the 9th floor but walls of 10th floor are not completely built yet, then crew would sit idle and get paid for those days doing nothing. This is where algorithm comes in.

The algorithm works on scheduling repetitive projects, where activity duration in each unit may vary due to resource productivity or differences in work amounts among units, so that crews may work continuously without interruption. The sequence step algorithm is first to address problem of scheduling probabilistic repetitive projects to eliminate crew idle time.

The algorithm can be easily adapted to different resource-based simulation software by adding two nested loops – an **Inner Replication Loop** and an **Outer Sequence-Step Loop.**

There are three general steps –

- The first step is to simulate network and collect time (CIT) for which crew is idle in each project replica. After performing a number of replications CIT samples are arranged in a histogram-like-intervals based on relative frequency.
- In the second step, we decide a certain cumulative probability for CIT we calculated in first step and we assign corresponding time value to be duration of
**X_CrewLeadTime**which was initially 0 for all activities. - In the third step, we reset simulation model and clear all previously collected CIT statistics for all activities. Using already assigned
**X_CrewLeadTime durations**(CLT) for all activities in previous sequence steps, we move to next sequence step and repeat first and second algorithm steps until we reach last sequence step.

**Flowchart –**

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.