Virtual Memory - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Virtual Memory

Description:

Not always (small segments may transfer ... Second-chance. Clock. Least recently used (and variants of it) Random. Ageing. Not recently used ... Second-chance ... – PowerPoint PPT presentation

Number of Views:11
Avg rating:3.0/5.0
Slides: 25
Provided by: mcho6
Category:

less

Transcript and Presenter's Notes

Title: Virtual Memory


1
Virtual Memory
  • Minh Chuong

2
Methods for Data Transfer
  • Paging fixed sized data being swapped
  • Segmentation variable sized memory blocks

3
Comparison
  Paging Segmentation
Words per address One Two
Programmer Visible? Invisible to application programmer May be visible to application programmer
Replacing a block Trivial (all blocks are the same size) Hard (must find contiguous, variable-size, unused portion of main memory)
Memory use inefficiency Internal fragmentation (unused portion of page) External fragmentation (unused portion of main memory)
Efficient disk traffic Yes (adjust page size to balance access time and transfer time) Not always (small segments may transfer just a few bytes)
 
4
Translation Lookaside Buffer
  • TLB a special cache used to keep track of
    recently used translation
  • use bit monitor usage for replacement
  • dirty bit monitor alterations

5
Page Table Actions
6
Virtual Memory Summary
CPU
virtual address
TLB
Page table
physical address
Cache
DRAM
physical address
disk address
Disk
7
Paged Virtual Memory
  • Page Tables
  • Paging
  • Dynamic Address Translation
  • Paging Supervisor
  • Permanently Resident Pages

8
Page Tables
  • Used to translate virtual addresses seen by the
    application program into physical addresses

9
Paging
  • Process of saving inactive virtual memory pages
    to disk and restoring them to real memory when
    required

10
Dynamic Address Translation
  • Translates address of particular instructions at
    virtual address to corresponding physical address
    (MMU), raises a page fault exception when page
    tables indicate that the virtual memory page
    isnt currently in real memory

11
Paging Supervisor
  • Part of the OS that creates and manages page
    tables
  • When the dynamic address translation hardware
    raises page fault exception, paging supervisor
    searches the paged files (on disk) and reads it
    into physical memory

12
Permanently Resident Pages
  • Memory that can not be swapped out for secondary
    storage
  • Interrupt
  • Page tables
  • Data buffer
  • Timing-dependent kernel/application

13
Page Replacement Algorithms
  • Local selects for replacement some page that
    belongs to that same process or group of
    processes sharing a memory partition
  • Global free to select any page in memory to
    replace

14
Algorithms
  • Not recently Used
  • First-in, First-out
  • Second-chance
  • Clock
  • Least recently used (and variants of it)
  • Random
  • Ageing

15
Not recently used
  • Favours keeping pages in memory that have been
    recently used.
  • Class 0 not referenced, not modified
  • Class 1 not referenced, modified
  • Class 2 referenced, not modified
  • Class 3 referenced, modified
  • Randomly picks from lowest category for removal

16
First-in, first-out
  • Pages in memory are kept in a queue, pages in the
    front gets replaced first

17
Second-chance
  • Similar to first-in, first-out except that
    theres a reference bit, if front of queues
    pages reference bit is not set, it will be
    swapped out, else it is moved to the back of the
    queue

18
Clock
  • Even more efficient version of FIFO
  • Has an iterator pointing at oldest page, if
    reference bit is not set, it gets replace, else
    iterator is incremented to next

19
Least recently used
  • Replaces the least recently used pages in memory

20
Random
  • Just replaces a random page in memory

21
Not frequently used
  • Every page has a counter
  • All pages that have been referenced gets counter
    incremented
  • Page with lowest counter is swapped out

22
Ageing
  • Descendant of not frequently used
  • Pages with closer to present time has higher
    impact as to it being swapped out or not
  • Page with lowest counter and oldest references
    get swapped out

23
Thrashing
  • Shuffling blocks of virtual memory between real
    memory and disks

24
  • Thank You
Write a Comment
User Comments (0)
About PowerShow.com