示例#1
0
def main():
    if len(sys.argv) <= 5:
        scheduler = int(sys.argv[1])
        the_lambda = int(sys.argv[2])
        average_service_time = float(sys.argv[3])
        if len(sys.argv) == 5:
            quantum = float(sys.argv[4])
        else:
            quantum = 0

    end_condition = 10000

    sim = Simulator(scheduler, the_lambda, average_service_time, quantum,
                    end_condition)
    sim.run()
    sim.generateReport()
import sys
from Simulator import Simulator

if __name__ == "__main__":
    the_lambda = 1

    for scheduler in range(1, 6):
        if scheduler is 1:
            print("Running FCFS Scheduler")
            while the_lambda < 31:
                sim = Simulator(scheduler, the_lambda, .06, 0, 10000)
                sim.run()
                sim.generateReport()
                the_lambda += 1
            the_lambda = 1

        elif scheduler is 2:
            print("Running SRTF Scheduler ")
            while the_lambda < 31:
                sim = Simulator(scheduler, the_lambda, .06, 0, 10000)
                sim.run()
                sim.generateReport()
                the_lambda += 1
            the_lambda = 1

        elif scheduler is 3:
            print("Running HRRN Scheduler")
            while the_lambda < 31:
                sim = Simulator(scheduler, the_lambda, .06, 0, 10000)
                sim.run()
                sim.generateReport()