%matplotlib inline import matplotlib.pyplot as plt import numpy as np runningjobs = [] # the array of running jobs numrunning = [] timestamp = 0 stagein = 2 processingtime = 300 stageout = 0 nextstart = timestamp + stagein for i in range(0, 1000): if timestamp == nextstart: runningjobs.append(timestamp+300) nextstart = timestamp + stagein if len(runningjobs) > 0 and runningjobs[0] <= timestamp: runningjobs.pop(0) numrunning.append(len(runningjobs)) timestamp += 1 plt.plot(numrunning) plt.ylabel("Running Jobs") plt.xlabel("Time (m)")