CSc 335
Project 4 FAQ

  1. How do I know what logical address caused the page fault?

    When a page fault is thrown, you can figure out what page needs to be loaded since the offending instruction's logical address is stored in BadVAddrReg. It's set to the correct address in ExceptionHandler in machine.cc. Use it to get the page number.

  2. I'm crashing from a process that hasn't been page faulting at all! It worked before. What's going on?

    This could be lots of things, but one common error is the following. Say Process A page faults and your PRA picks a frame from Process B as the victim. You then need to go to Process B's pagetable and search it so you can change the appropriate page table entry to invalid. When you do the search, be sure to search for an entry where both the frame number is the victim frame and the valid bit is TRUE. If you just search for the victim frame #, that frame # may appear multiple times in a table (since for some entries, the frame # will be associated with an invalid page). You need both conditions in order to change the correct page table entry. If you change the wrong page table entry, then when process B starts up again, the page table entry that should have been made invalid will still say 'valid', and the CPU will merrily go to that frame and try to run what's there (even though it's a Process A page now). At that point, a seg fault is a definite possibility.

  3. When I run nachos, I get so much output that I can't scroll back to the beginning to see it all. Can I save the output to a file?

    Sure can. Just use the redirect (>) operator. So

    nachos -x ../test/halt > foo

    will save the output into a file called "foo". Then use any editor to view the file.


FAQ index