5. Exercises

If disk.py fails with error "ImportError: No module named Tkinter": sudo apt install -y python-tk
or just comment out the line: from Tkinter import * and don't use the graphics -G option

Exercises from the book using disk.py:

Defaults: Seek time = 40 per track, Rotate time = 30 per sector

$ python ./disk.py -a 7,30,8 -c -p FIFO

REQUESTS [7, 30, 8]

Block:   7  Seek:  0  Rotate: 15  Transfer: 30  Total:  45
Block:  30  Seek: 80  Rotate:220  Transfer: 30  Total: 330
Block:   8  Seek: 80  Rotate:310  Transfer: 30  Total: 420

TOTALS      Seek:160  Rotate:545  Transfer: 90  Total: 795

$ python ./disk.py -a 7,30,8 -c -p SATF

REQUESTS [7, 30, 8]

Block:   7  Seek:  0  Rotate: 15  Transfer: 30  Total:  45
Block:   8  Seek:  0  Rotate:  0  Transfer: 30  Total:  30
Block:  30  Seek: 80  Rotate:190  Transfer: 30  Total: 300

TOTALS      Seek: 80  Rotate:205  Transfer: 90  Total: 375