Operating System Fundamentals


Pages, Virtual Addresses and Physical Memory



Download 2.34 Mb.
View original pdf
Page42/66
Date06.03.2023
Size2.34 Mb.
#60834
1   ...   38   39   40   41   42   43   44   45   ...   66
OperatingSystemFundamentals
best answers from c, Lesson 2 C# Windows Forms
Pages, Virtual Addresses and Physical Memory
Figure 4.3 (right) shows how pages, virtual addresses and physical memory are combined to create a virtual memory system. The memory manager maintains both a virtual memory space and a Page Table. All processes and data that are loaded into either main memory or the page file hard disk) are given addresses in the virtual
memory space. The Page Table keeps track of the locations of all the pages. Although pages maybe located on different physical devices, the memory manager treats them as if they are all contained in one large memory system. When a page is actually needed for processing, it is loaded into main memory (RAM. Older pages that are not currently being processed maybe
swapped from RAM back to the paging device usually a hard disk.


0-4 KKK KKK AACBCCPage Process C)
Page Process A)
Free Space
Page Process A)
Virtual Memory
Space
Page
Table
Physical Memory
(RAM)
Paging Device
(Hard Disk)
Figure 4.4
Combining Elements to Create
a Virtual Memory System

Operating System Fundamentals
59
Swapping Pages
Whenever main memory (RAM) is full, or when a page is requested that is located in virtual memory, the memory manager needs to swap old or unused pages from RAM into virtual memory in order to make space for the new pages being loaded. There area number of strategies used by the memory manager to handle this task. These strategies are often called
replacement policies. There are five main replacement policies that are used by operating systems Random Replacement First In First Out (FIFO) Second Chance Least Recently used Least Frequently Used Each of these replacement policies uses different algorithms for selecting pages to be swapped from RAM into the page file.
Random Replacement
Replace pages in main memory randomly. On the average, does notwork well.
FIFO
Uses a queue data structure to keep track of the pages in main memory. Oldest page at the front (head) and newest page at the back (tail. Always replace (get rid of) the oldest page. Does not always work, because the oldest page may still be used by the process.
Second Chance
Another version of FIFO to address the problem of FIFO. All pages in the page table are tracked to see if they have been referenced recently by a process. A Reference (R) bit for each page is used for this purpose o R = 1 when the page is being referenced. o R = 0 when the page has not been used after a time period. o The OS will periodically check the (R) bit for each page and move the pages those R) = 1 to the tail of the queue thus given and chance.

Download 2.34 Mb.

Share with your friends:
1   ...   38   39   40   41   42   43   44   45   ...   66




The database is protected by copyright ©ininet.org 2024
send message

    Main page