Page 108 - Handout of Computer Architecture (1)..
P. 108

It creates the illusion of a very large main memory by using part of the secondary storage (hard disk or
               SSD) as an extension of RAM.

               4.8.2 Why Virtual Memory is Used


                   1.  Run large programs that do not fit completely in RAM.
                   2.  Allow multiple programs to run at the same time.
                   3.  Improve memory utilization.
                   4.  Provide memory protection between processes.


               4.8.3 Basic Idea


               When a program is running:

                   •  Only some parts of the program are loaded into RAM.
                   •  The rest stays in secondary storage (disk).
                   •  When the CPU needs a part that is not in RAM, the operating system loads it from disk into RAM.

               This process is called Page Fault Handling.


               4.8.4 Key Components
               4.8 .4.1  Pages

               The program is divided into fixed-size blocks called Pages.


               Example: Page size = 4 KB

               4.8 .4.2. Frames

               RAM is divided into blocks of the same size called Frames.


               Each page from disk can be loaded into any free frame in RAM.

               4.8 .4.3. Page Table

               The Page Table is a data structure used by the OS to map:


               Virtual Address → Physical Address

               It tells the system where each page is located in RAM.


               4.8.4.4. Page Fault

               A Page Fault happens when:




                                                             108
   103   104   105   106   107   108   109   110   111   112   113