Simulator

This lesson explains how to run the simulator that mimics the MLFQ scheduler.

This program, mlfq.py, allows you to see how the MLFQ scheduler presented in this chapter behaves. As before, you can use this to generate problems for yourself using random seeds, or use it to construct a carefully-designed experiment to see how MLFQ works under different circumstances.

To run the program, type the following in the terminal provided below:

prompt> ./mlfq.py

Use the help flag (-h) to see the options:

Usage: mlfq.py [options]
Options:
  -h, --help            show this help message and exit
  -s SEED, --seed=SEED  the random seed
  -n NUMQUEUES, --numQueues=NUMQUEUES
                        number of queues in MLFQ (if not using -Q)
  -q QUANTUM, --quantum=QUANTUM
                        length of time slice (if not using -Q)
  -Q QUANTUMLIST, --quantumList=QUANTUMLIST
                        length of time slice per queue level, 
                        specified as x,y,z,... where x is the 
                        quantum length for the highest-priority 
                        queue, y the next highest, and so forth
  -j NUMJOBS, --numJobs=NUMJOBS
                        number of jobs in the system
  -m MAXLEN, --maxlen=MAXLEN
                        max run-time of a job (if random)
  -M MAXIO, --maxio=MAXIO
                        max I/O frequency of a job (if random)
  -B BOOST, --boost=BOOST
                        how often to boost the priority of all 
                        jobs back to high priority (0 means never)
  -i IOTIME, --iotime=IOTIME
                        how long an I/O should last (fixed constant)
  -S, --stay            reset and stay at same priority level 
                        when issuing I/O
  -l JLIST, --jlist=JLIST
                        a comma-separated list of jobs to run, 
                        in the form x1,y1,z1:x2,y2,z2:... where 
                        x is start time, y is run time, and z 
                        is how often the job issues an I/O request
  -c                    compute answers for me
]

Get hands-on with 1400+ tech skills courses.