Discussion:
crc code available in the project4 distribution
(too old to reply)
Iulian Neamtiu
2005-04-06 16:31:59 UTC
Permalink
As I mentioned in recitation today,
you might want to print the CRC ('digest') of the page you're paging out
and the CRC of the page when you bring it in, in order to make sure you
bring the correct page in from disk, and the page doesn't get corrupted.

GeekOS comes with crc computing routines. All you have to do is:
- in your Write_To_Paging_File() ,compute the CRC of the page you're
about to page out:
crc32(0, paddr, PAGE_SIZE)
and save it in the associated Disk_Page structure.

- in your Read_From_Paging_File(), after you read from the disk into
paddr, compute the CRC of the page you've read from the disk:
crc32(0, paddr, PAGE_SIZE)

The two crc's should obviously be equal.

Iulian
Huyen Tue Dao
2005-04-06 22:18:39 UTC
Permalink
Post by Iulian Neamtiu
As I mentioned in recitation today,
you might want to print the CRC ('digest') of the page you're paging out
and the CRC of the page when you bring it in, in order to make sure you
bring the correct page in from disk, and the page doesn't get corrupted.
I'm sorry, but could you clarify what the CRC of a page is for those of
us who couldn't make it to discussion?

Thanks,
H
Iulian Neamtiu
2005-04-07 02:18:29 UTC
Permalink
The problem some students had - was that upon paging in, the program
crashes most likely because
- the index in the paging device was incorrect, so the wrong page was
brought in, and/or
- the paging device gets corrupted because of some wild write caused by
poor management of space /indexes in the paging device.

If you print the virtual address, index and the crc when you swap out
and when you swap in, the values should match exactly. If they don't,
you might have one or both of the problems mentioned above.

Iulian
Post by Huyen Tue Dao
Post by Iulian Neamtiu
As I mentioned in recitation today,
you might want to print the CRC ('digest') of the page you're paging out
and the CRC of the page when you bring it in, in order to make sure you
bring the correct page in from disk, and the page doesn't get corrupted.
I'm sorry, but could you clarify what the CRC of a page is for those of
us who couldn't make it to discussion?
Thanks,
H
Continue reading on narkive:
Loading...