INTRODUCTION
TO
OPERATING SYSTEMS
Lecture 11: MEMORY MANAGEMENT (2)
CHRIS STAFF
Dept. of Computer Science and Artificial Intelligence
University of Malta
Lecture Outline
Aims and Objectives
Memory Management Techniques (1) - Paging
Memory Management Techniques (2) - Segmentation Systems
Memory Management Techniques (3) - Combined Paging / Segmentation Systems
Aims and Objectives
- Paged Systems
- Segmentation Systems
- Combined Paging / Segmentation System
Memory Memagement Techniques (1) - Paging
Concepts
- A page is a fixed-size block
- Virtual address, v = (p,d) [page number, displacement]
- Physical Memory is organised into Page Frames, which are equal in size
to the Virtual page.
- If a page is not in PM, then it can be swapped in from secondary storage and
placed in any free page frame.
Dynamic Address Translation for Paged Systems
- Item's virtual memory address referenced by v = (p, d).
- Look up p in page map table to determine that p is on page
frame p'
- Multiply p'by the page size to obtain the address of the page
frame
- Add d to P' to obtain the real address of the item
- But what happens if page is not in PM? - 3 different techniques
Page Address Translation by Direct Mapping
- If required page not already in PM, then Missing Page Fault issued
- Page map table contains entry for every page in process' virtual address
space
- Process execution time effectively doubled, because every time virtual
address referenced, 2 PM reads are required - 1 to look up physical address,
other to read contents of phy. address!
Page Address Translation by Associative Mapping
- Costs of Associative memory are prohibitive, so usually this method of
dynamic address translation is combined with Direct Mapping
Page Address Translation with combined Associative / Direct Mapping
- The Associative Storage will contain a partial associative page map of the
most-recently referenced pages only (Translation Lookaside Buffer)
- Virtual Page entry searched for in TLB. If Found, continue as per associative
store.
- Otherwise, access full page map table in PM.
- Update TLB with this page's details, replacing least-recently referenced
page.
- Only 8 or 16 cells needed to achieve 90% performance of full asociative page
maps.
Sharing in a Paged System
- Page Frames can be shared by pointing to the same page frame from each
processes' page map table.
Advantages and disadvantages
+ easy to tell how many pages can be held in memory simultaneously
- Internal Fragmentation
Memory Management Techniques (2) - Segmentation Systems
- Segment is a chunk of virtual memory. Segments can be variably sized, to
accommodate entire process.
- Virtual Address is v = (s, d) [segment no., displacement]
- Segments transferred betwen PM and Secondary Storage as complete units
- Address Translation is the same as for Paged Systems. If a segment is not in
PM a Missing Segment Fault is generated.
- Incoming segments are placed in any large enough free area of PM (Best Fit /
First Fit).
Sharing in a Segmented System
- Different processes can reference the same segment through their segment
table
Advantages and Disadvantages
Memory Management Techniques (3) - Combined Paging / Segmentation Systems
- Combines Paging and Segmentation systems to benefit from advantages of
both systems.
- Segments will contain a variable number of pages.
- Not all pages need be in Primary Memory (PM) at the same time.
- Virtual address is referenced by v = (s, p, d) [segment number, page number
within segment, displacement within page]
Dynamic Address Translation in Paging/Segmentation Systems (using combined
associative / direct mapping)
Sharing in a Paging/ Segmentation System
- Entries in different segment map tables for different processes can point to
the same page map table.
Next Lecture...
Memory Management (3)