R. Clayton (rclayton@monmouth.edu)
(no date)
Another thing I don't understand about my os is that the pa1-forkjoin.dsk
program always tries to join itself. Why is that?
Before going to the analysis, I should emphasize I'm doing this to illustrate
some some techniques you can use to discover what your os is doing (or not
doing). I am not advertising a service I'm providing to people who's
programs aren't working.
I don't see where there's a self-join problem, but I do see other problems:
$ ./os -Dintr,disk-io -d /e*/h*/c*/*5/d*/pa1-forkjoin.dsk
At time 0, on reboot interrupt entry, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 0
ia: 0 ps: 0x00000000 tp: 0 bs: 0
At time 0, disk read begins with block number = 0 and address = 1024.
On reboot interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
This is correct: your os runs the idle process and brings in the program
block on boot-up.
At time 10, the disk read from block 0 to location 1024 ends.
At time 10, on disk interrupt entry, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
On disk interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4000
ia: 0 ps: 0x00000101 tp: 4064 bs: 4000
At time 11, on invalid-address interrupt entry, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4000
ia: 4000 ps: 0x00000101 tp: 4064 bs: 4000
Right again. The os sees a program on the disk and (I'm guessing) schedules
it for immediate execution, which results in a page fault on the first
address.
At time 11, disk read begins with block number = 1 and address = 1024.
On invalid-address interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
At time 22, the disk read from block 1 to location 1024 ends.
At time 22, on disk interrupt entry, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
On disk interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4000
ia: 4000 ps: 0x00000101 tp: 4064 bs: 4000
Schedule a page-in and run the idle process. When the page shows up, return
process 1 to the cpu. Fine.
At time 26, on system-call interrupt entry, registers 0-15 are
0: 3 1: 1 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 801 10: 0 pc: 4004
ia: 4000 ps: 0x00000101 tp: 4064 bs: 4000
On system-call interrupt exit, registers 0-15 are
0: 1 1: 2 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4004
ia: 4000 ps: 0x00000101 tp: 4064 bs: 4000
The page shows up, process 1 starts running and forks process 2. Your os
apparently doesn't context switch to the new process so process 1 keeps
running.
At time 30, on system-call interrupt entry, registers 0-15 are
0: 4 1: 2 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4010
ia: 4000 ps: 0x00000109 tp: 4064 bs: 4000
On system-call interrupt exit, registers 0-15 are
0: 7 1: 1 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4010
ia: 4000 ps: 0x00000109 tp: 4064 bs: 4000
Process 1 issues a join system call on process 2; everything's in order. But
the join system call returns back to process 1, which is wrong: process 2
hasn't finished execution yet (it hasn't even started execution yet) and
process 1 should block in the join until process 2 exits.
At time 33, on invalid-address interrupt entry, registers 0-15 are
0: 7 1: 1 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4012
ia: 4032 ps: 0x00000105 tp: 4064 bs: 4000
At time 33, disk read begins with block number = 2 and address = 1056.
On invalid-address interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
The status for the join system call (in register 0) is not ok (value 1), so
process 1 prints an error message. The error message is stored in the second
page of the program (at address 4032 as indicated by the invalid-address
register), which triggers another page-in.
At time 44, the disk read from block 2 to location 1056 ends.
At time 44, on disk interrupt entry, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
On disk interrupt exit, registers 0-15 are
0: 7 1: 1 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4012
ia: 4032 ps: 0x00000105 tp: 4064 bs: 4000
The page containing the error message lands in User Space and process 1
continues with printing the now resident error message.
At time 45, on invalid-address interrupt entry, registers 0-15 are
0: 7 1: 1 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 4012
ia: 4032 ps: 0x00000105 tp: 4064 bs: 4000
At time 45, disk read begins with block number = 2 and address = 1088.
On invalid-address interrupt exit, registers 0-15 are
0: 0 1: 0 2: 0 3: 0
4: 0 5: 0 6: 0 7: 0
8: 0 9: 0 10: 0 pc: 39
ia: 4 ps: 0x00000000 tp: 40 bs: 39
But process 1 throws another page fault at the same address (4032). This
suggest to me that your os isn't maintaining the page table correctly.
At this point the os goes into an infinite loop, with process 1 page faulting
on 4032 and the os paging it in.
This archive was generated by hypermail 2.0b3 on Fri Aug 23 2002 - 19:30:05 EDT