Simulator
This lesson explains how to interact with the simulator for the exercise presented in the next lesson.
We'll cover the following...
This exercise uses disk.py
to familiarize you with how a modern hard
drive works. It has a lot of different options, and unlike most of the other
simulations, it has a graphical animator to show you exactly what happens when
the disk is in action.
NOTE
There is also an experimental program,
disk-precise.py
along with thedisk.py
. This version of the simulator uses the python Decimal package for precise floating-point computation, thus giving slightly better answers in some corner cases thandisk.py
. However, it has not been very carefully tested, so use at your own caution.
Let’s do a simple example first. To run the simulator and compute some basic seek, rotation, and transfer times, you first have to give a list of requests to the simulator. This can either be done by specifying the exact requests, or by having the simulator generate some randomly.
We’ll start by specifying a list of requests ourselves. Let’s do a single request first:
prompt> ./disk.py -a 10
At this point you’ll see:
...
REQUESTS [br '10']
For the requests above, compute the seek, rotate, and transfer times.
Use -c
or the graphical mode with -G
...