Simulator

This lesson will teach you how to run the multi-CPU scheduling simulator so you can play around​ with it and enhance your understanding.

We'll cover the following...

Welcome to multi.py, a rudimentary multi-CPU scheduling simulator. This simulator has a number of features to play with, so pay attention! Or don’t, because you are lazy that way. But when that exam rolls around…

To run the simulator, all you have to do is type:

prompt> ./multi.py

Try it out yourself in the terminal provided below:

Terminal 1
Terminal
Loading...

This will then run the simulator with some random jobs.

Before we get into any such details, let’s first examine the basics of such a simulation.

In the default mode, there are one or more CPUs in the system (as specified with the -n flag). Thus, to run with 4 CPUs in your simulation, type the following in the terminal provided above:

prompt> ./multi.py -n 4

Each CPU has a cache, which can hold important data from one or more running processes. The size of each CPU cache is set by the -M flag. Thus, to make each cache have a size of ‘100’ on your 4-CPU system, run:

prompt> ./multi.py -n 4 -M 100

To run a simulation, you need some jobs to schedule. There are two ways to do this.

The first is to let the system create some jobs with random characteristics for you (this is the default, i.e., if you specify nothing, you get this); there are also some controls to ...