Docsity

Memory Management: Segmentation, Paging, and Replacement Policies, Study Guides, Projects, Research of Computer Architecture and Organization

Toggle sidebar
bg1
1
Segmentation
•May be unequal, dynamic size
•Simplifies handling of growing data
structures
•Allows programs to be altered and
recompiled independently
•Lends itself to sharing data among
processes
•Lends itself to protection
2
Segment Tables
•Corresponding segment in main memory
•Each entry contains the length of the
segment
•A bit is needed to determine if segment
is already in main memory
•Another bit is needed to determine if the
segment has been modified since it was
loaded in main memory
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Memory Management: Segmentation, Paging, and Replacement Policies and more Study Guides, Projects, Research Computer Architecture and Organization in PDF only on Docsity!

1

Segmentation

  • May be unequal, dynamic size
  • Simplifies handling of growing data

structures

  • Allows programs to be altered and

recompiled independently

  • Lends itself to sharing data among

processes

  • Lends itself to protection

Segment Tables

  • Corresponding segment in main memory
  • Each entry contains the length of the

segment

  • A bit is needed to determine if segment

is already in main memory

  • Another bit is needed to determine if the

segment has been modified since it was

loaded in main memory

3

Segment Table Entries

7

9

Fetch Policy

  • Fetch Policy
    • Determines when a page should be brought into memory
    • Demand paging only brings pages into main memory when a reference is made to a location on the page - Many page faults when process first started
    • Prepaging brings in more pages than needed - More efficient to bring in pages that reside contiguously on the disk

Placement Policy

  • Determines where in real memory a

process piece is to reside

  • Important in a segmentation system
  • Paging or combined paging with

segmentation hardware performs address

translation

13

Basic Replacement

Algorithms

  • Optimal policy
    • Selects for replacement that page for which the time to the next reference is the longest
    • Impossible to have perfect knowledge of future events
    • This policy is “wishful thinking”, but can serve as a base-line when post-evaluating different policies

Basic Replacement

Algorithms

  • Least Recently Used (LRU)
    • Replaces the page that has not been referenced for the longest time
    • By the principle of locality, this should be the page least likely to be referenced in the near future
    • Each page could be tagged with the time of last reference. This would require a great deal of overhead.

15

Basic Replacement

Algorithms

  • First-in, first-out (FIFO)
    • Treats page frames allocated to a process as a circular buffer
    • Pages are removed in round-robin style
    • Simplest replacement policy to implement
    • Page that has been in memory the longest is replaced
    • These pages may be needed again very soon
    • Performs relatively poorly

Basic Replacement

Algorithms

  • Clock Policy
    • Additional bit called a use bit
    • When a page is first loaded in memory, the use bit is set to 1
    • When the page is referenced, the use bit is set to 1
    • When it is time to replace a page, the first frame encountered with the use bit set to 0 is replaced.
    • During the search for replacement, each use bit set to 1 is changed to 0

19 Comparison of Placement Algorithms case study: page size = 256 words