SlideShare a Scribd company logo
1 of 27
FORMALISING PAGING
L J Gokul Vasan
1Formalising Paging
Page and Page frames
• N is a set of page indices
– N = {1, 2, 3, …, n}.
– Each consisting of c contiguous
memory space.
• M is a set of page frame indices
– M = {1, 2, 3, …, m}.
– Each consisting of c contiguous
address space.
• 1 ≤ m ≤ n.
• At each moment of time t there is a page
map
ft : N → M ∪ { 0 } s.t.
2Formalising Paging
Address Translation
• When a processor generates an
address α, the hardware
computes memory location
address :
– Where x is determined from :
• If ft(x)= 0, the hardware
generates a page fault interrupt
that signals an appropriate task to
secure the missing page from
auxiliary memory.
3Formalising Paging
Reference String
• A program’s paging behaviour for a given input is described in machine independent
terms by its (page) reference string, which is a sequence:
• The discrete time parameter t= 1,2,3,… represents instants in “process” or “execution”
time.
• rt = i means that page “i” is referenced at tth reference.
• We use the notation NT for the set of all reference string of length T.
N+ will denote set of all finite-length strings over N, not including the empty string.
• Corresponding to the references r1r2r3…rt… is a sequence of instants in real time
a1a2a3…at… s.t. at is the instant at which rt is made.
• P(ω) : Probability mass function over NT, s.t. denotes the probability of ω’s occurance.
4Formalising Paging
Reference String( Exemplified )
Formalising Paging 5
t 1
rt r1
i 1
ω = {r1}
Reference String( Exemplified )
• rt
• r1
• i
• 1
Formalising Paging 6
ω = {r1 r2}
t 1 2
rt r1 r2
i 1 5
Reference String( Exemplified )
Formalising Paging 7
ω = {r1 r2 r3}
t 1 2 3
rt r1 r2 r3
i 1 5 2
Speed Ratio
• ΔA : Average time to transfer a page between
auxiliary memory and main memory.
• Δm : Average time to access a word when page is
in main memory.
• Speed ratio :
• Intuitively, it’s the number of time increase in
access because of auxiliary memory with respect
to main memory.
Auxiliary
Memory
8Formalising Paging
CPU
ΔAΔm
Space Time Product
• Real time elapsing between t and t+1 in
process time is approximately
• Fault rate F(ω) : number of page faults
encountered while processing the reference
string ω.
• Space time:
9Formalising Paging
Paging Algorithm
• Paging algorithm A is a mechanism for processing
reference string
• This generates a sequence of memory states
• Each memory state St is the set of pages from N
which reside in M at time t and they satisfy:
• Where |S| denotes the number of elements in S.
10Formalising Paging
Paging Algorithm ( cont )
• St and St-1 are related by
– {xt} : set of fetched pages.
– {yt} : set of replaced pages.
• Q : set of records called control states with initial
state be q0.
• A configuration of an algorithm is any pair
(S, q) | |S| ≤ m and q ∈ Q.
11Formalising Paging
Paging Algorithm ( cont )
• Transition function of algorithm A, gA is defined
as:
• Where
– (S, q) is current configuration and
– (S’, q’) is next configuration.
• precisely, S0S1S2…St… is contained in
configuration sequence
generated by :
12Formalising Paging
Paging Algorithm ( Pictorial )
13Formalising Paging
Paging Algorithm ( Exemplified )
• A paging algorithm A is a demand paging
algorithm if for a given m > 0 the transition
function gA implies that
• The choice y of page to be replaced is
prerogative of algorithm A.
14Formalising Paging
Forward Distance
• Forward distance: Distance to the first reference
to x after time t.
15Formalising Paging
Backward Distance
• Backward distance: The distance to the most recent
reference to x before time t.
16Formalising Paging
Reuse Distance
• Reuse distance: Distance between two occurances
of x after time t.
17Formalising Paging
Replacement Algorithm
• Replacement algorithm is denoted as R(S,q,x)
– S : current state of memory
– q: current configuration
– x: rt+1 the next reference.
• Suppose |S| = m and x ∉ S then.
18Formalising Paging
Cost Function
• The cost generated by paging algorithm A,
operating on reference string ω=r1r2…rt in
memory of size m, is denoted C(A, m, ω)
• h(k) : cost of a single auxiliary memory
transaction involving group of k pages.
• Expected cost :
• We define A to be optimal with respect to p(ω)
if it minimizes C(A, m)
19Formalising Paging
Optimal Replacement policy
• Page faults are unavoidable.
• Best choice of replacement algorithm A: replace
page with longest expected forward distance.
• By doing so, A maximizes the expected time
between page faults due to returning pages and
therefore cost.
20Formalising Paging
Belady’s OPT Algorithm ( B0 )
• Replace page with largest forward distance.
• Theoretical approach, cannot be implemented.
21Formalising Paging
ω r1 r2 r3 r4 r5
i 1 2 3 1 2
S2 S3
X 2 3
Y - 2
1 3
2 2
m
R(S2 , q2 , 3 ) = 2
t
Least Recently Used ( LRU )
• The page in S that is replaced is the one with
largest backward distance.
22Formalising Paging
ω r1 r2 r3 r4 r5
i 1 2 3 2 1
S2 S3
X 2 3
Y - 1
1 3
2 2
m
R(S2 , q2 , 3 ) = 1
FORMALLY
t
Least Frequently Used ( LFU )
• Replace page with least use.
ft(x) denote the number of references to x in r1…rt
23Formalising Paging
ω r1 r2 r3 r4 r5
i 1 2 2 3 1
m
R(S2 , q2 , 3 ) = 1
S2 S3
X - 3
Y - 1
1 3
22 22
FORMALLY
t
Replacement Algorithms
24Formalising Paging
Predicament
• Does not care locality of a programme.
• Some approximation algorithms are well suited
for some applications, but not for all.
• It fails to distinguish between individual pages,
making the program spatially uniform.
• Does not account for the dependence of present
behaviour on the past.
Formalising Paging 25
Thank You
Formalising Paging 26
references
THEORETICAL REFERENCES:
• Belady, L.A. A study of replacement algorithms for virtual storage computers. IBM Systems J. 5, 2 (1966), 78–101.
• Peter J. Denning . Thrashing: its causes and prevention. AFIPS '68 (Fall, part I) Proceedings of the December 9-11, 1968, fall joint
computer conference, part I. Pages 915-922.
• P. J. Denning. Dynamic Storage Allocation Systems. IEEE Transactions on Computers Volume 18 Issue 9, September 1969
Page 866-866.
• Peter J. Denning . Principles of computer system organization. ACM SIGCSE Bulletin Volume 1 Issue 3, October 1969
Pages 27-30.
• Coffman, E. G. Jr., and Denning, P. J. Operating Systems Theory, Prentice-Hall, Englewood Cliffs, New Jersey, 1973.
• A.V. Aho, P.J. Denning, and J.D. Ullman, “Principles of Optimal Page Replacement,” J. ACM, vol. 18, no. 1, 1971, pp. 80-93.
ALGORITHMS REFERENCES:
• E.J. O’Neil, P.E. O’Neil, and G. Weikum, “An Optimality Proof of the LRU-K Page Replacement Algorithm,” J. ACM, vol. 46, no. 1,
1999, pp. 92-112.
• T. Johnson and D. Shasha, “2Q: A Low OverheadHigh-Performance Buffer Management Replacement Algorithm,” Proc. VLDB
Conf., Morgan Kaufmann, 1994, pp. 297-306.
• S. Jiang and X. Zhang, “LIRS: An Efficient Low Inter- Reference Recency Set Replacement Policy to Improve Buffer Cache
Performance,” Proc. ACM Sigmetrics Conf., ACM Press, 2002; http://parapet.ee.princeton.edu/ sigm2002/papers/p31-jiang.pdf.
• Y. Zhou and J.F. Philbin, “The Multi-Queue Replacement Algorithm for Second-Level Buffer Caches,” Proc. Usenix Ann. Tech. Conf.
(Usenix 2001), Usenix, 2001, pp. 91-104.
• N. Megiddo and D.S. Modha, “ARC: A Self-Tuning, Low Overhead Replacement Cache,” Proc. Usenix Conf. File and
StorageTechnologies (FAST 2003), Usenix, 2003, pp. 115-130.
• S. Bansal, and D. Modha, CAR: Clock with Adaptive Replacement, FAST-’04 Proceedings of the 3rd USENIX Conference on File and
Storage Technologies, pp. 187-200, 2004.
27Formalising Paging

More Related Content

What's hot

PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
pgdayrussia
 
IOEfficientParalleMatrixMultiplication_present
IOEfficientParalleMatrixMultiplication_presentIOEfficientParalleMatrixMultiplication_present
IOEfficientParalleMatrixMultiplication_present
Shubham Joshi
 
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
Computer Science Club
 
06 how to write a map reduce version of k-means clustering
06 how to write a map reduce version of k-means clustering06 how to write a map reduce version of k-means clustering
06 how to write a map reduce version of k-means clustering
Subhas Kumar Ghosh
 

What's hot (20)

distance_matrix_ch
distance_matrix_chdistance_matrix_ch
distance_matrix_ch
 
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
 
Finding similar items in high dimensional spaces locality sensitive hashing
Finding similar items in high dimensional spaces  locality sensitive hashingFinding similar items in high dimensional spaces  locality sensitive hashing
Finding similar items in high dimensional spaces locality sensitive hashing
 
Amortized analysis
Amortized analysisAmortized analysis
Amortized analysis
 
JGrass-NewAge rain-snow separation
JGrass-NewAge rain-snow separationJGrass-NewAge rain-snow separation
JGrass-NewAge rain-snow separation
 
IOEfficientParalleMatrixMultiplication_present
IOEfficientParalleMatrixMultiplication_presentIOEfficientParalleMatrixMultiplication_present
IOEfficientParalleMatrixMultiplication_present
 
JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component JGrass-NewAge probabilities backward component
JGrass-NewAge probabilities backward component
 
Graph Regularised Hashing
Graph Regularised HashingGraph Regularised Hashing
Graph Regularised Hashing
 
13 Amortized Analysis
13 Amortized Analysis13 Amortized Analysis
13 Amortized Analysis
 
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
Andrew Goldberg. Highway Dimension and Provably Efficient Shortest Path Algor...
 
JGrass-NewAge water budget
JGrass-NewAge water budget JGrass-NewAge water budget
JGrass-NewAge water budget
 
JGrass-NewAge probabilities forward component
JGrass-NewAge probabilities forward component JGrass-NewAge probabilities forward component
JGrass-NewAge probabilities forward component
 
Aoa amortized analysis
Aoa amortized analysisAoa amortized analysis
Aoa amortized analysis
 
06 how to write a map reduce version of k-means clustering
06 how to write a map reduce version of k-means clustering06 how to write a map reduce version of k-means clustering
06 how to write a map reduce version of k-means clustering
 
A Gentle Introduction to Locality Sensitive Hashing with Apache Spark
A Gentle Introduction to Locality Sensitive Hashing with Apache SparkA Gentle Introduction to Locality Sensitive Hashing with Apache Spark
A Gentle Introduction to Locality Sensitive Hashing with Apache Spark
 
JGrass-Newage snow component
JGrass-Newage snow componentJGrass-Newage snow component
JGrass-Newage snow component
 
06.09.2017 Computer Science, Machine Learning & Statistiks Meetup - MULTI-GPU...
06.09.2017 Computer Science, Machine Learning & Statistiks Meetup - MULTI-GPU...06.09.2017 Computer Science, Machine Learning & Statistiks Meetup - MULTI-GPU...
06.09.2017 Computer Science, Machine Learning & Statistiks Meetup - MULTI-GPU...
 
Hyperparameter optimization with approximate gradient
Hyperparameter optimization with approximate gradientHyperparameter optimization with approximate gradient
Hyperparameter optimization with approximate gradient
 
20131114
2013111420131114
20131114
 
Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++
 

Similar to Formalising paging in memory management

19 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp0219 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp02
Muhammad Aslam
 
Module 1 notes of data warehousing and data
Module 1 notes of data warehousing and dataModule 1 notes of data warehousing and data
Module 1 notes of data warehousing and data
vijipersonal2012
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysis
Anindita Kundu
 

Similar to Formalising paging in memory management (20)

Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02
 
C++ Notes PPT.ppt
C++ Notes PPT.pptC++ Notes PPT.ppt
C++ Notes PPT.ppt
 
lecture1.ppt
lecture1.pptlecture1.ppt
lecture1.ppt
 
Asymptotic Notations.pptx
Asymptotic Notations.pptxAsymptotic Notations.pptx
Asymptotic Notations.pptx
 
19 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp0219 algorithms-and-complexity-110627100203-phpapp02
19 algorithms-and-complexity-110627100203-phpapp02
 
DSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfDSJ_Unit I & II.pdf
DSJ_Unit I & II.pdf
 
14 query processing-sorting
14 query processing-sorting14 query processing-sorting
14 query processing-sorting
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Module 1 notes of data warehousing and data
Module 1 notes of data warehousing and dataModule 1 notes of data warehousing and data
Module 1 notes of data warehousing and data
 
Data structure and algorithm using java
Data structure and algorithm using javaData structure and algorithm using java
Data structure and algorithm using java
 
asymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysisasymptotic analysis and insertion sort analysis
asymptotic analysis and insertion sort analysis
 
ASYMTOTIC NOTATIONS BIG O OEMGA THETE NOTATION.pptx
ASYMTOTIC NOTATIONS BIG O OEMGA THETE NOTATION.pptxASYMTOTIC NOTATIONS BIG O OEMGA THETE NOTATION.pptx
ASYMTOTIC NOTATIONS BIG O OEMGA THETE NOTATION.pptx
 
Course-Notes__Advanced-DSP.pdf
Course-Notes__Advanced-DSP.pdfCourse-Notes__Advanced-DSP.pdf
Course-Notes__Advanced-DSP.pdf
 
Advanced_DSP_J_G_Proakis.pdf
Advanced_DSP_J_G_Proakis.pdfAdvanced_DSP_J_G_Proakis.pdf
Advanced_DSP_J_G_Proakis.pdf
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
CS6401 Operating systems - Solved Examples
CS6401 Operating systems - Solved ExamplesCS6401 Operating systems - Solved Examples
CS6401 Operating systems - Solved Examples
 
Lecture12
Lecture12Lecture12
Lecture12
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Formalising paging in memory management

  • 1. FORMALISING PAGING L J Gokul Vasan 1Formalising Paging
  • 2. Page and Page frames • N is a set of page indices – N = {1, 2, 3, …, n}. – Each consisting of c contiguous memory space. • M is a set of page frame indices – M = {1, 2, 3, …, m}. – Each consisting of c contiguous address space. • 1 ≤ m ≤ n. • At each moment of time t there is a page map ft : N → M ∪ { 0 } s.t. 2Formalising Paging
  • 3. Address Translation • When a processor generates an address α, the hardware computes memory location address : – Where x is determined from : • If ft(x)= 0, the hardware generates a page fault interrupt that signals an appropriate task to secure the missing page from auxiliary memory. 3Formalising Paging
  • 4. Reference String • A program’s paging behaviour for a given input is described in machine independent terms by its (page) reference string, which is a sequence: • The discrete time parameter t= 1,2,3,… represents instants in “process” or “execution” time. • rt = i means that page “i” is referenced at tth reference. • We use the notation NT for the set of all reference string of length T. N+ will denote set of all finite-length strings over N, not including the empty string. • Corresponding to the references r1r2r3…rt… is a sequence of instants in real time a1a2a3…at… s.t. at is the instant at which rt is made. • P(ω) : Probability mass function over NT, s.t. denotes the probability of ω’s occurance. 4Formalising Paging
  • 5. Reference String( Exemplified ) Formalising Paging 5 t 1 rt r1 i 1 ω = {r1}
  • 6. Reference String( Exemplified ) • rt • r1 • i • 1 Formalising Paging 6 ω = {r1 r2} t 1 2 rt r1 r2 i 1 5
  • 7. Reference String( Exemplified ) Formalising Paging 7 ω = {r1 r2 r3} t 1 2 3 rt r1 r2 r3 i 1 5 2
  • 8. Speed Ratio • ΔA : Average time to transfer a page between auxiliary memory and main memory. • Δm : Average time to access a word when page is in main memory. • Speed ratio : • Intuitively, it’s the number of time increase in access because of auxiliary memory with respect to main memory. Auxiliary Memory 8Formalising Paging CPU ΔAΔm
  • 9. Space Time Product • Real time elapsing between t and t+1 in process time is approximately • Fault rate F(ω) : number of page faults encountered while processing the reference string ω. • Space time: 9Formalising Paging
  • 10. Paging Algorithm • Paging algorithm A is a mechanism for processing reference string • This generates a sequence of memory states • Each memory state St is the set of pages from N which reside in M at time t and they satisfy: • Where |S| denotes the number of elements in S. 10Formalising Paging
  • 11. Paging Algorithm ( cont ) • St and St-1 are related by – {xt} : set of fetched pages. – {yt} : set of replaced pages. • Q : set of records called control states with initial state be q0. • A configuration of an algorithm is any pair (S, q) | |S| ≤ m and q ∈ Q. 11Formalising Paging
  • 12. Paging Algorithm ( cont ) • Transition function of algorithm A, gA is defined as: • Where – (S, q) is current configuration and – (S’, q’) is next configuration. • precisely, S0S1S2…St… is contained in configuration sequence generated by : 12Formalising Paging
  • 13. Paging Algorithm ( Pictorial ) 13Formalising Paging
  • 14. Paging Algorithm ( Exemplified ) • A paging algorithm A is a demand paging algorithm if for a given m > 0 the transition function gA implies that • The choice y of page to be replaced is prerogative of algorithm A. 14Formalising Paging
  • 15. Forward Distance • Forward distance: Distance to the first reference to x after time t. 15Formalising Paging
  • 16. Backward Distance • Backward distance: The distance to the most recent reference to x before time t. 16Formalising Paging
  • 17. Reuse Distance • Reuse distance: Distance between two occurances of x after time t. 17Formalising Paging
  • 18. Replacement Algorithm • Replacement algorithm is denoted as R(S,q,x) – S : current state of memory – q: current configuration – x: rt+1 the next reference. • Suppose |S| = m and x ∉ S then. 18Formalising Paging
  • 19. Cost Function • The cost generated by paging algorithm A, operating on reference string ω=r1r2…rt in memory of size m, is denoted C(A, m, ω) • h(k) : cost of a single auxiliary memory transaction involving group of k pages. • Expected cost : • We define A to be optimal with respect to p(ω) if it minimizes C(A, m) 19Formalising Paging
  • 20. Optimal Replacement policy • Page faults are unavoidable. • Best choice of replacement algorithm A: replace page with longest expected forward distance. • By doing so, A maximizes the expected time between page faults due to returning pages and therefore cost. 20Formalising Paging
  • 21. Belady’s OPT Algorithm ( B0 ) • Replace page with largest forward distance. • Theoretical approach, cannot be implemented. 21Formalising Paging ω r1 r2 r3 r4 r5 i 1 2 3 1 2 S2 S3 X 2 3 Y - 2 1 3 2 2 m R(S2 , q2 , 3 ) = 2 t
  • 22. Least Recently Used ( LRU ) • The page in S that is replaced is the one with largest backward distance. 22Formalising Paging ω r1 r2 r3 r4 r5 i 1 2 3 2 1 S2 S3 X 2 3 Y - 1 1 3 2 2 m R(S2 , q2 , 3 ) = 1 FORMALLY t
  • 23. Least Frequently Used ( LFU ) • Replace page with least use. ft(x) denote the number of references to x in r1…rt 23Formalising Paging ω r1 r2 r3 r4 r5 i 1 2 2 3 1 m R(S2 , q2 , 3 ) = 1 S2 S3 X - 3 Y - 1 1 3 22 22 FORMALLY t
  • 25. Predicament • Does not care locality of a programme. • Some approximation algorithms are well suited for some applications, but not for all. • It fails to distinguish between individual pages, making the program spatially uniform. • Does not account for the dependence of present behaviour on the past. Formalising Paging 25
  • 27. references THEORETICAL REFERENCES: • Belady, L.A. A study of replacement algorithms for virtual storage computers. IBM Systems J. 5, 2 (1966), 78–101. • Peter J. Denning . Thrashing: its causes and prevention. AFIPS '68 (Fall, part I) Proceedings of the December 9-11, 1968, fall joint computer conference, part I. Pages 915-922. • P. J. Denning. Dynamic Storage Allocation Systems. IEEE Transactions on Computers Volume 18 Issue 9, September 1969 Page 866-866. • Peter J. Denning . Principles of computer system organization. ACM SIGCSE Bulletin Volume 1 Issue 3, October 1969 Pages 27-30. • Coffman, E. G. Jr., and Denning, P. J. Operating Systems Theory, Prentice-Hall, Englewood Cliffs, New Jersey, 1973. • A.V. Aho, P.J. Denning, and J.D. Ullman, “Principles of Optimal Page Replacement,” J. ACM, vol. 18, no. 1, 1971, pp. 80-93. ALGORITHMS REFERENCES: • E.J. O’Neil, P.E. O’Neil, and G. Weikum, “An Optimality Proof of the LRU-K Page Replacement Algorithm,” J. ACM, vol. 46, no. 1, 1999, pp. 92-112. • T. Johnson and D. Shasha, “2Q: A Low OverheadHigh-Performance Buffer Management Replacement Algorithm,” Proc. VLDB Conf., Morgan Kaufmann, 1994, pp. 297-306. • S. Jiang and X. Zhang, “LIRS: An Efficient Low Inter- Reference Recency Set Replacement Policy to Improve Buffer Cache Performance,” Proc. ACM Sigmetrics Conf., ACM Press, 2002; http://parapet.ee.princeton.edu/ sigm2002/papers/p31-jiang.pdf. • Y. Zhou and J.F. Philbin, “The Multi-Queue Replacement Algorithm for Second-Level Buffer Caches,” Proc. Usenix Ann. Tech. Conf. (Usenix 2001), Usenix, 2001, pp. 91-104. • N. Megiddo and D.S. Modha, “ARC: A Self-Tuning, Low Overhead Replacement Cache,” Proc. Usenix Conf. File and StorageTechnologies (FAST 2003), Usenix, 2003, pp. 115-130. • S. Bansal, and D. Modha, CAR: Clock with Adaptive Replacement, FAST-’04 Proceedings of the 3rd USENIX Conference on File and Storage Technologies, pp. 187-200, 2004. 27Formalising Paging