[OS]Virtual memory

Virtual Storage (Memory)

  • Non-continuous allocation

Address Mapping

  • Continuous allocation
    • Relative address
    • Relocation
  • Non-continuous allocation
    • Virtual address = relative address
      • Logical address
    • Real address = abosolute(physical)
  • Address mapping
    • Virtual address -> real address

Block Mapping

  • Virtual address : v = (b,d)
    • b = block number
    • d = displacement(offset) in a block
  • Blck map table(BMT)

Virtual Storage Methods

  • Paging system
  • Segmentation system
  • Hybrid paging/segmentation system

Paging system

  • Terminologies
    • Page
    • Page frame
  • Simple and Efficient
    • Segmentation
  • No external fragmentation
    • Internal fragmentation possible

      Address Mapping

  • Virtual address : v = (p,d)
    • p : page number
    • d : displacement(offset)
  • Address mapping
    • PMT(age Map Table)
  • Address mapping mechanism
    • Direct mapping
    • Associative mapping
      • TLB(Translation Look-aside Buffer)
    • Hybrid direct/associative mapping

Direct Mapping

  • Problem
    • performance degradation
  • Solution
    • Associative mapping(TLB)
  • Hierarchical paging
  • Hashed page table
  • Inverted page table

Associative Mapping

  • PMT in TLB(Translation Look-aside Buffer)
    • Associative high-speed memory
  • Low overhead, high speed
  • Expensive hardware

Hybrid Direct/Associative Mapping

  • Use Locality

Memory Management

  • page
    • Page frame
  • Frame table
    • One entry per page frame
  • Configuration
    • Allocated/available field
    • PID field
    • Link field : For free list
    • AV : Free list headeentry

Page Sharing

  • Non-continuous allocation
  • Procedure pages
    • Pure code (reenter code)
  • Data page
    • Read-only data
    • Read-write data

Segmentation System

  • Segment
    • ex) stack, heap, .ain procedure, shared lib, Etc.
  • Distinction
    • Segmet sharing/protection
    • High overhead for Address mapping
    • No internal fragmentation
      • External fragmentation possible

Address mapping

  • Virtual address: v = (s,d)
    • s : segment number
    • d : displacement in a segment
  • Segment Map Table (SMT)
  • Address mapping mechanism

Hybrid paging/Segmentation System

Address mapping

  • Virtual address : v = (s, p, d)
    • s : segment number
    • p : page number
    • d : offset in a page
  • Use SMT and PMT
  • Address mapping
    • Dirct, associated etc.

Reference

Virtural memory