Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Virtual Memory
Introduction
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
Demand Paging
Preliminaries
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
Page Replacement
(Empirical) law of locality of
reference: logical addresses used by
process in a short interval tend to be
grouped in certain portions of its
logical address space
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
10
Memory Allocation to a
Process
How much memory to allocate to a
process
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
11
12
Paging Hardware
Page-table-address-register (PTAR)
points to the start of a page table
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
13
Paging Hardware
(continued)
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
14
Memory Protection
Memory protection violation raised if:
Process tries to access a nonexistent
page
Process exceeds its (page) access
privileges
It is implemented through:
Page table size register (PTSR) of MMU
Kernel records number of pages contained in
a process in its PCB
Loads number from PCB in PTSR when process is
scheduled#Sushanth KJ|Faculty,ECE|BIT,
Mlore
15
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
16
TLBs can be HW or
SW KJ|Faculty,ECE|BIT,
managed
#Sushanth
Mlore
17
Superpages
TLB reach is stagnant even though memory sizes
increase rapidly as technology advances
TLB reach = page size x no of entries in TLB
It affects performance of virtual memory
19
20
21
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
22
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
12.23
24
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
25
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
26
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
27
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
28
29
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
30
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
31
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
32
#Sushanth KJ|Faculty,ECE|BIT,
33
34
35
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
36
37
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
38
39
Shared Pages
Static sharing results from static binding
performed by a linker/loader before execution
of program
Dynamic binding conserves memory by
binding same copy of a program/data to
several processes
Program or data shared retains its identity
Two conditions should be satisfied:
Shared program should be coded as reentrant
Can be invoked by many processes at the same time
40
Shared pages
should have same
page numbers in
all processes
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
41
Copy-on-Write
Feature used to conserve memory
when data in shared pages could be
modified
Copy-on-write flag in page table entries
Memory allocation decisions areA private copy of
page k is made
performed statically
when A modifies it
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
42
Memory-Mapped Files
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
43
Memory-Mapped Files
(continued)
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
44
#Sushanth KJ|Faculty,ECE|BIT,
Mlore
45
46
Summary
Basic actions in virtual memory using paging:
address translation and demand loading of
pages
Implemented jointly by
Memory Management Unit (MMU): Hardware
Virtual memory manager: Software
47
Summary (continued)
Which page should VM manager remove from
memory to make space for a new page?
Page replacement algorithms exploit locality of
reference
LRU has stack property, but is expensive
NRU algorithms are used in practice
E.g., clock algorithms
48