views:

37

answers:

1

This is a statement referring to problem caused by page fault:(from Silberschatz 7th ed P-310 last para)

'We cant simply restart instructions when instruction modifies several different location Ex:when a instruction moves 256 bytes from source to dest and either src or dest straddles on page boundary , then,after a partial move, if a page fault occurs, 'we can't simply restart the instructions'

My question is:: Why not? Simply restart the instruction again do the same copy after page is in. Is there any problem in it?

[edit]Can anyone explain What exactly happens in case source and destination locations are overlapping? [/edit] P.S=> sorry for the late edit.

A: 

Because the counter register (e.g. ECX) has been changed since the start of the operation.

Fyodor Soikin
@soikin can you please become a little more descriptive :)
Vikas
I assume the instruction being discussed is something like `MOVSx` or `STOSx`. These instructions move byte by byte (or word by word, or whatever) and decrement the `ECX` register every step. When `ECX` reaches zero, the instruction ends. Now assume you had a page fault in the middle of transferring 256 bytes. Now your `ECX` contains 128. If you simply restart the instruction, it will only transfer 128 bytes instead of 256 as the programmer originally intended. Clear enough?
Fyodor Soikin
@Soikin when the instruction will be restarted, shouldn't the register be reloaded again with 256?Also give a look to my edit please.
Vikas
No, it wouldn't. The register is loaded by some previous instruction, and not necessarily the one immediately preceding the MOVS instruction. It could be loaded explicitly sometime in the past, or it could be calculated out of some other values.
Fyodor Soikin
Your questions suggest that you're not familiar with low-level machine instructions. Asking random questions like that will not get you the big-picture understanding. This is not some kind of scripting language or HTML markup. A thorough approach is required here. Therefore, I suggest you read a book on basic assembly language first, and only then dive deeper.
Fyodor Soikin
@Fyodor Hmm.. getting your point to some extent and thanks for your suggestion. :)
Vikas