-
Q: What is the value for "CPU BURST WAS xxx INSTRUCTIONS"?
A: It is the cumulated CPU burst time after the last context switch. It is stored in the field pcb->sjnburst
-
Q: What is OldState?
A: Inside Interrupt_Handler, CPU is in a different context. So before Interrupt_Handler, we save the cpu status into OldState.
After Interrupt_Handler, we probabily do a context switch, and we restore the CPU status of that process.
In Interrupt(): CPU.pc ==> OldState;NewState ==> CPU.pc
In Interrupt_Handler(): OldState ==> CPU.actvpcb->cpu_save
In Dispatcher(): CPU.actvpcb->cpusave.pc ==> CPU.pc
-
Q: What should we do in LoadMap()
A: We should first initialize MEMMAP, set accbits = 0 for all entries, so that prevent accessing for no existing segment.
Then copy user's segtable to global segtable MEMMAP. User's segtable may have less entry than MEMMAP
-
Q: What if the process is end, but there is still unfinished I/O request?
A: We will wait for these I/O request to finish before we bring the next program. So inside Purge_rb, don't purge unfinished request.
Also in End_Service, don't call Next_pgm if there is unfinished I/O.
-
Q: I can match some part of the output, but after a certain point, it runs wild. What can I do?
A: I provide a trace file here. You can check your program step by step with the trace.
The trace file include two information:
* new_events before Interrupt()
* the instruction running in CPU()