Assignment 2 test disk questions.


R. Clayton (rclayton@monmouth.edu)
Mon, 30 Oct 2000 11:04:29 -0500 (EST)


When the OS receives a read system call, assuming that everything is ok, the OS
will set the disk_command_register to read the disk block. At the same time,
the OS should sleep user process until the OS received the disk interrupt, then
resume the cpu, right?

  Yes; the os should sleep the user process until user process's disk io
  operation is done.
  
When I tested the pa2-diskrw.dsk, my debug result shows me only one read
system call from the program 1, instead of 32 read and write calls as you
said. I don't know what is wrong, and wonder whether the statement (1) is
right or not.
  
  Let's take a look:

    cl pa2os -Df30,disk-io -d /export/opt/cs-438-505/devices/pa2-diskrw.dsk
    At time 0, process 1 runs.
    At time 10, the disk read from block 0 to location 1024 ends.
    At time 23, the disk read from block 3 to location 1088 ends.
    At time 34, the disk read from block 2 to location 1056 ends.
    At time 45, the disk read from block 1 to location 1024 ends.
    At time 45, process 2 runs.
    At time 57, process 1 runs.
    At time 81, the disk read from block 27 to location 1856 ends.
    At time 127, the disk read from block 63 to location 1057 ends.
    At time 127, process 2 runs.
    At time 138, process 1 runs.
    At time 174, the disk read from block 26 to location 1824 ends.
    At time 221, the disk write to block 63 from location 1057 ends.
    At time 221, process 2 runs.
    At time 231, process 1 runs.
    At time 269, the disk read from block 25 to location 1792 ends.
    At time 317, the disk read from block 63 to location 1057 ends.
    At time 317, process 2 runs.
    At time 328, process 1 runs.
    At time 366, the disk read from block 24 to location 1760 ends.
    At time 415, the disk write to block 63 from location 1057 ends.
    At time 415, process 2 runs.
    At time 425, process 1 runs.
    At time 465, the disk read from block 23 to location 1728 ends.
    At time 515, the disk read from block 63 to location 1057 ends.
    At time 515, process 2 runs.
    At time 526, process 1 runs.
    At time 566, the disk read from block 22 to location 1696 ends.
    At time 617, the disk write to block 63 from location 1057 ends.
    At time 617, process 2 runs.
    At time 627, process 1 runs.
    At time 669, the disk read from block 21 to location 1664 ends.
    At time 721, the disk read from block 63 to location 1057 ends.
    At time 721, process 2 runs.
    At time 732, process 1 runs.
    At time 774, the disk read from block 20 to location 1632 ends.
    At time 827, the disk write to block 63 from location 1057 ends.
    At time 827, process 2 runs.
    At time 837, process 1 runs.
    At time 881, the disk read from block 19 to location 1600 ends.
    At time 935, the disk read from block 63 to location 1057 ends.
    At time 935, process 2 runs.
    At time 946, process 1 runs.
    At time 990, the disk read from block 18 to location 1568 ends.
    At time 1045, the disk write to block 63 from location 1057 ends.
    At time 1045, process 2 runs.
    At time 1055, process 1 runs.
    At time 1101, the disk read from block 17 to location 1536 ends.
    At time 1157, the disk read from block 63 to location 1057 ends.
    At time 1157, process 2 runs.
    At time 1168, process 1 runs.
    At time 1214, the disk read from block 16 to location 1504 ends.
    At time 1271, the disk write to block 63 from location 1057 ends.
    At time 1271, process 2 runs.
    At time 1281, process 1 runs.
    At time 1329, the disk read from block 15 to location 1472 ends.
    At time 1387, the disk read from block 63 to location 1057 ends.
    At time 1387, process 2 runs.
    At time 1398, process 1 runs.
    At time 1446, the disk read from block 14 to location 1440 ends.
    At time 1505, the disk write to block 63 from location 1057 ends.
    At time 1505, process 2 runs.
    At time 1515, process 1 runs.
    At time 1565, the disk read from block 13 to location 1408 ends.
    At time 1625, the disk read from block 63 to location 1057 ends.
    At time 1625, process 2 runs.
    At time 1636, process 1 runs.
    At time 1686, the disk read from block 12 to location 1376 ends.
    At time 1747, the disk write to block 63 from location 1057 ends.
    At time 1747, process 2 runs.
    At time 1757, process 1 runs.
    At time 1809, the disk read from block 11 to location 1344 ends.
    At time 1871, the disk read from block 63 to location 1057 ends.
    At time 1871, process 2 runs.
    At time 1882, process 1 runs.
    At time 1934, the disk read from block 10 to location 1312 ends.
    At time 1997, the disk write to block 63 from location 1057 ends.
    At time 1997, process 2 runs.
    At time 2007, process 1 runs.
    At time 2061, the disk read from block 9 to location 1280 ends.
    At time 2125, the disk read from block 63 to location 1057 ends.
    At time 2125, process 2 runs.
    At time 2136, process 1 runs.
    At time 2190, the disk read from block 8 to location 1248 ends.
    At time 2255, the disk write to block 63 from location 1057 ends.
    At time 2255, process 2 runs.
    At time 2265, process 1 runs.
    At time 2321, the disk read from block 7 to location 1216 ends.
    At time 2387, the disk read from block 63 to location 1057 ends.
    At time 2387, process 2 runs.
    At time 2398, process 1 runs.
    At time 2454, the disk read from block 6 to location 1184 ends.
    At time 2521, the disk write to block 63 from location 1057 ends.
    At time 2521, process 2 runs.
    At time 2531, process 1 runs.
    At time 2589, the disk read from block 5 to location 1152 ends.
    At time 2657, the disk read from block 63 to location 1057 ends.
    At time 2657, process 2 runs.
    At time 2668, process 1 runs.
    At time 2726, the disk read from block 4 to location 1120 ends.
    At time 2726, process 3 runs.
    At time 2752, process 3 exits.
    At time 2752, process 1 runs.
    At time 2795, the disk write to block 63 from location 1057 ends.
    At time 2795, process 2 runs.
    At time 2805, process 1 runs.
    At time 2815, the disk read from block 63 to location 1057 ends.
    At time 2815, process 2 runs.
    At time 2826, process 1 runs.
    At time 2836, the disk write to block 63 from location 1057 ends.
    At time 2836, process 2 runs.
    At time 2846, process 1 runs.
    At time 2856, the disk read from block 63 to location 1057 ends.
    At time 2856, process 2 runs.
    At time 2867, process 1 runs.
    At time 2877, the disk write to block 63 from location 1057 ends.
    At time 2877, process 2 runs.
    At time 2887, process 1 runs.
    At time 2897, the disk read from block 63 to location 1057 ends.
    At time 2897, process 2 runs.
    At time 2908, process 1 runs.
    At time 2918, the disk write to block 63 from location 1057 ends.
    At time 2918, process 2 runs.
    At time 2928, process 1 runs.
    At time 2938, the disk read from block 63 to location 1057 ends.
    At time 2938, process 2 runs.
    At time 2949, process 1 runs.
    At time 2959, the disk write to block 63 from location 1057 ends.
    At time 2959, process 2 runs.
    At time 2969, process 1 runs.
    At time 2979, the disk read from block 63 to location 1057 ends.
    At time 2979, process 2 runs.
    At time 2990, process 1 runs.
    At time 3000, the disk write to block 63 from location 1057 ends.
    At time 3000, process 2 runs.
    At time 3010, process 1 runs.
    At time 3020, the disk read from block 63 to location 1057 ends.
    At time 3020, process 2 runs.
    At time 3031, process 1 runs.
    At time 3041, the disk write to block 63 from location 1057 ends.
    At time 3041, process 2 runs.
    At time 3051, process 1 runs.
    At time 3061, the disk read from block 63 to location 1057 ends.
    At time 3061, process 2 runs.
    At time 3072, process 1 runs.
    At time 3082, the disk write to block 63 from location 1057 ends.
    At time 3082, process 2 runs.
    At time 3092, process 1 runs.
    At time 3102, the disk read from block 63 to location 1057 ends.
    At time 3102, process 2 runs.
    At time 3113, process 1 runs.
    At time 3123, the disk write to block 63 from location 1057 ends.
    At time 3123, process 2 runs.
    At time 3133, process 1 runs.
    At time 3143, the disk read from block 63 to location 1057 ends.
    At time 3143, process 2 runs.
    At time 3154, process 1 runs.
    At time 3164, the disk write to block 63 from location 1057 ends.
    At time 3164, process 2 runs.
    At time 3174, process 1 runs.
    At time 3184, the disk read from block 63 to location 1057 ends.
    At time 3184, process 2 runs.
    At time 3195, process 1 runs.
    At time 3205, the disk write to block 63 from location 1057 ends.
    At time 3205, process 2 runs.
    At time 3215, process 1 runs.
    At time 3225, the disk read from block 63 to location 1057 ends.
    At time 3225, process 2 runs.
    At time 3236, process 1 runs.
    At time 3246, the disk write to block 63 from location 1057 ends.
    At time 3246, process 2 runs.
    At time 3256, process 1 runs.
    At time 3266, the disk read from block 63 to location 1057 ends.
    At time 3266, process 2 runs.
    At time 3277, process 1 runs.
    At time 3287, the disk write to block 63 from location 1057 ends.
    At time 3287, process 2 runs.
    At time 3297, process 1 runs.
    At time 3307, the disk read from block 63 to location 1057 ends.
    At time 3307, process 2 runs.
    At time 3318, process 1 runs.
    At time 3328, the disk write to block 63 from location 1057 ends.
    At time 3328, process 2 runs.
    At time 3338, process 1 runs.
    At time 3348, the disk read from block 63 to location 1057 ends.
    At time 3348, process 2 runs.
    At time 3359, process 1 runs.
    At time 3369, the disk write to block 63 from location 1057 ends.
    At time 3369, process 2 runs.
    At time 3379, process 1 runs.
    At time 3389, the disk read from block 63 to location 1057 ends.
    At time 3389, process 2 runs.
    At time 3400, process 1 runs.
    At time 3410, the disk write to block 63 from location 1057 ends.
    At time 3410, process 2 runs.
    At time 3420, process 1 runs.
    At time 3430, the disk read from block 63 to location 1057 ends.
    At time 3430, process 2 runs.
    At time 3441, process 1 runs.
    At time 3451, the disk write to block 63 from location 1057 ends.
    At time 3451, process 2 runs.
    At time 3461, process 1 runs.
    At time 3471, the disk read from block 63 to location 1057 ends.
    At time 3471, process 2 runs.
    At time 3482, process 1 runs.
    At time 3492, the disk write to block 63 from location 1057 ends.
    At time 3492, process 2 runs.
    At time 3502, process 1 runs.
    At time 3512, the disk read from block 63 to location 1057 ends.
    At time 3512, process 2 runs.
    At time 3523, process 1 runs.
    At time 3533, the disk write to block 63 from location 1057 ends.
    At time 3533, process 2 runs.
    At time 3543, process 1 runs.
    At time 3553, the disk read from block 63 to location 1057 ends.
    At time 3553, process 2 runs.
    At time 3564, process 1 runs.
    At time 3574, the disk write to block 63 from location 1057 ends.
    At time 3574, process 2 runs.
    At time 3584, process 1 runs.
    At time 3594, the disk read from block 63 to location 1057 ends.
    At time 3594, process 2 runs.
    At time 3605, process 1 runs.
    At time 3615, the disk write to block 63 from location 1057 ends.
    At time 3615, process 2 runs.
    At time 3625, process 2 exits.
    At time 3625, process 1 runs.

    The system is halted.
    Total execution time: 3625 ticks, idle time: 2823 ticks (77%).

    cl
  
  Process 1 is the idle process; process 2 is the test process. The test
  process reads and writes disk block 63; if you count them up, the test
  process does 32 reads and 32 writes.

  With respect to your first question, notice that the test process gets
  replaced by the idle process throughout the execution history; this happens
  then the test process schedules disk io and gets swapped out until the io
  completes (the next read or write relative to disk block 63).

In your email for pa2-diskrw.dsk, it said that the small process writes the
last block of the batch disk a word at a time. You told me last Friday, disk
read and write system calls always read/write one disk block.
  
  What I meant to say is that the small process read one disk block, changes
  one word in the block and then writes the block back to disk. The small
  process repeats these three steps 32 times, reading and writing the same disk
  block, but changing a different word in the block each time. Sorry for the
  confusion.

In your email for pa2-diskrw.dsk, it said that the small program started
executing at 1024. Why is that? Since it is the first program to load and my
result shows me it start at clock tick 43.

  Sorry again: the small process starts executing at location 1024 in user
  space.



This archive was generated by hypermail 2.0b3 on Mon Dec 18 2000 - 13:30:06 EST