Virtual Memory:Part 2: Kashyap Sheth Kishore Putta Bijal Shah Kshama Desai
Virtual Memory:Part 2: Kashyap Sheth Kishore Putta Bijal Shah Kshama Desai
Kashyap Sheth
Kishore Putta
Bijal Shah
Kshama Desai
Index
Recap
Translation lookaside buffer
Segmentation
Segmentation with paging
Working set model
References
Terms & Notions
Virtual memory (VM) is
Not a physical device but an abstract concept
Comprised of the virtual address spaces (of all
processes)
Virtual address space (VAS) (of one
process)
Set of visible virtual addresses
(Some systems may use a single VAS for all
processes)
Paging
Page: The Virtual Address Space is divided into
equal number of units called a Page. Each page is
of the same size.
Page frame: The Physical Address Space is divided
into equal number of units called Page Frames.
Each page frame is of the same size.
Memory Management Unit (MMU): it is used to map
the virtual address onto the physical address.
Translation Lookaside Buffer
Each virtual memory reference can cause
two physical memory accesses
one to fetch the page table
one to fetch the data
To overcome this problem a high-speed
cache is set up for page table entries
called the TLB - Translation Lookaside Buffer
Translation Lookaside Buffer
Contains page table entries that have been
most recently used
Functions same way as a memory cache
Translation Lookaside Buffer
Given a virtual address, processor examines
the TLB
If page table entry is present (a hit), the frame
number is retrieved and the real address is
formed
If page table entry is not found in the TLB (a
miss), the page number is used to index the
process page table
Translation Lookaside Buffer
First checks if page is already in main
memory
if not in main memory a page fault is issued
The TLB is updated to include the new page
entry
Operation of Paging and
Translation Lookaside
Buffer
(Stallings Fig 8.8)
Use of a Translation Lookaside Buffer
(Stallings Fig 8.7)
Segmentation
What is Segmentation?
Segmentation: Advantages
Segmentation: Disadvantages
Virtual address space
Call stack
free
Constant table
Source text
Symbol table has
Symbol table bumped into the source
text table
What is Segmentation?
virtual address External
Segment # Offset fragmentation
Seg 1
(code) Seg 2 Physical
(data) memory
Seg 3
as in paging:
(stack)
valid, modified, Seg 3
Virtual memory protection, etc. (stack)
Seg Page
ment table
limit base
yes Physical
CPU
s so < so memory
Logical no
address p po
Memory +
trap
Page table (for
segment)
f po
f
CoSP: Advantages
Reduces memory usage as opposed to pure paging
Page table size limited by segment size
internal
fragmentation
Working Sets
• Working set of pages: minimum collection
of pages that must be loaded in main
memory for a process to operate efficiently
without unnecessary page faults.
“Smallest collection of information that must be
present in main memory to assure efficient execution
of the program.
Process/Working Set: two manifestations of same
ongoing computational activity.
Working Set Strategy
W(t,D) = set of pages in memory at time t of
that process that have been referenced in the
last D virtual time units.
Virtual time = time that elapses while process in
execution measured in instruction steps.
Working set size: number of pages in W(t,D).
Characteristics of Working
Sets
Size:
Working set is non decreasing function of window
(D) size. Specifically, W(t, D+1) contains W(t,D).