Page 109 - Handout of Computer Architecture (1)..
P. 109
• The CPU tries to access a page
• But the page is not currently in RAM
Steps:
1. OS detects the page fault
2. Finds the page on disk
3. Loads it into a free frame in RAM
4. Updates the page table
5. Execution continues
4.9 Advantages of Virtual Memory
• Programs larger than RAM can run
• Better multiprogramming
• Efficient memory use
• Process isolation and protection
4.9.1 Disadvantages
• Slower than RAM because disk access is slow
• Too many page faults cause Thrashing
4.9.2Thrashing
Thrashing occurs when:
• The system spends more time swapping pages between RAM and disk
• Instead of executing programs
This leads to very poor performance.
4.9.3 Simple Example
Suppose:
• Program size = 10 MB
• RAM available = 4 MB
Virtual memory allows:
• Only 4 MB of the program in RAM
• The rest 6 MB stays on disk
• Pages are loaded only when needed
https://www.youtube.com/watch?v=fGP6VHxqkIM
109

