Operating Systems

Virtual Memory

Ahmad Yoosofan

University of Kashan

Virtual Memory

Virtual Memory Addressing

Effective Access Time of Virtual Memory

Allocation of frames

روش‌های تخصیص تعداد قاب به هر فرآیند

سیاست‌های پاک کردن

Page Replacement

Frame Allocation

FIFO

Belady’s anomaly

Optimal

Not Recently Used Page(NRU)

NRU vs LRU

Least Recently Used(LRU)

How to Impolement LRU

LFU

Least Frequently Used

MFU

Most Frequently Used

page-replacement algorithm is based on the argument that the page with the smallest count was probably just brought in and has yet to be used

Use of a stack to record the most recent page references

Second chance (clock)

Simplest implementation of NRU and LRU by using one bit

Some called this NRU

Modefied Clock

Enhanced Second Chance

By the usage of

("modify bit", "use bit" or "access bit")

PAGE BUFFERING

Thrashing

mov A, B

Principle of Locality(Locality of Reference)

Two kinds of locality

Locality example

Locality Makes Caching Effective

Working Set Model

روش شناسایی کوبیدگی به کمک فراوانی خطای نبود صفحه

page-fault frequency ( PFF )

روش‌های رویارویی با کوبیدگی پس از شناسایی آن

پرونده‌های نگاشت شده به حافظه (Memory-Mapped Files)

ورودی و خروجی‌های نگاشت شده به حافظه

(I/O-Mapped Files)

  1. Graphic card
  2. Network

قفل کردن برخی صفحه‌ها

Lock pages

اثر نوع برنامه‌نویسی و کامپایلر بر حافظهٔ مجازی

1 void row_by_row(void){
2   double xa[1000][1000];
3   int i,j;
4   for(i=0;i<1000;i++)
5     for(j=0;j<1000;j++)
6       xa[i][j]=i*1000+j;
7 }
1 void column_by_column(void){
2   double xa[1000][1000];
3   int i,j;
4   for(j=0;j<1000;j++)
5     for(i=0;i<1000;i++)
6       xa[i][j]=i*1000+j;
7 }

Copy-on-Write

References(I)

References(II)

References(III)

1