Incrementing Disk Bytes Read

If the disk has not yet finished reading or writing from disk, then increment the disk bytes read by 1. More formally,

if the following are true:
  • value of cell 49 at time t = 1
  • disk bytes read at time t < value of cell 46 at time t

then disk bytes read at time (t + 1) = (disk bytes read at time t) + 1

If the disk has not yet finished, then that means it is still reading or writing values (one at a time), so increment the disk bytes read by 1.

For example, suppose that the following are true:

  • value of cell 46 at time 105 = 3
  • value of cell 49 at time 105 = 1
  • disk bytes read at time 105 = 0

The disk bytes read (0) is less than the data size (3). Thus: disk bytes read at time (105 + 1) = (disk bytes read at time 105) + 1

After some substitutions and simplification, this becomes:

disk bytes read at time 106 = 1

Try running the simulator below to see the "bytes read" count increase by 1.

Time: 0
LW Computer IO Simulator

Comments

Please log in to add comments