We must simulate the starting and stopping of a job. Lets assume that:
%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)")
<matplotlib.text.Text at 0x108420090>
As you can see from the plot above, the number of running jobs never reaches above 150.