I'm refering to those links:
I'm still confused how a process knows if one of its pages is swapped to the secondary memory.
Process A1 allocates 1 frame of physical memory, writes on it. The preset, modify and recent bit will be set to 1 in the PTE.
It's process A2 turn now - it need more memory and the
MMU kernel decides to write process A1's page to secondary memory, because the modify bit was set.
Process A1 is back again - restores his context and PT and is now ready to read/write its page (assumed the present bit still set to 1) and will access process A2s page.(?)
I understand that the process does not directly knows which pages is located where and the somehow the MMU knows that a page is on secondary memory - but somehow the PTE of process A1 has to be modified? There must be some information to the MMU or in the PT that the page is now swapped out and has to be restored from it. Edit: Will the present bit get changed to 0, even if the PT / PTE are on the stack?