Memory Management - Lecture Slides | COMP 310, Study notes of Operating Systems

Material Type: Notes; Class: Operating Systems; Subject: Computer Science; University: University of San Diego; Term: Fall 2004;

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-9dr-1
koofers-user-9dr-1 🇺🇸

10 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
COMP 310:
Operating Systems
Lecture 14:
Memory Management
October 6, 2004
Christine Alvarado
Today’s Topics
Begin Memory Management
Virtual memory:
Fixed Partitions
Variable Partitions
Paging
Segmentation
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Memory Management - Lecture Slides | COMP 310 and more Study notes Operating Systems in PDF only on Docsity!

COMP 310:

Operating Systems

Lecture 14:

Memory Management

October 6, 2004

Christine Alvarado

Today’s Topics

 Begin Memory Management

 Virtual memory:

 Fixed Partitions  Variable Partitions  Paging  Segmentation

What does the OS have to manage? Programs: Processes, Threads, Synchronization I/O: Hardware, Interrupts, Direct Memory Access Memory/Disk: Virtual Memory, Paging, Naming Memory Management

 Goals of Memory Management

 To provide convenient abstraction for programming  To maximize performance given scarce memory  To protect processes and their memory

 Mechanisms

 Physical and virtual addressing  Techniques: Partitioning, paging, segmentation  Page table management, TLBs, VM tricks

 Policies

 Page replacement algorithms

Physical Memory: To Run a Program… Memory My Program Physical Memory: To Run a Program Memory My Program

Physical Memory: Multi- processing Memory My Program Your Program Multi-programming and Memory

 Want multiple processes in memory at once

 Why?

 Multi-programming changes memory access

strategy

 Don’t let processes access memory directly

 OS allows processes to THINK they have direct

access… but they really don’t

How can we implement VM?

 Fixed Partitions

 Paging

 Segmentation

Fixed Partitions

 Physical Memory broken up into (surprise) Fixed

Partitions, all same size

 My program’s memory is all in one place, but I don’t exactly know where it starts P P P P2’s Base Offset Base Register

Advantages

 Easy to implement, fast context switch

P

P

P

P2’s Base Offset Base Register

Disadvantages

 Internal fragmentation: I may not use all of

my space

P

P

P

P2’s Base Offset Base Register

Disadvantages

 External Fragmentation: empty holes in memory

P

P

P

P2’s Base Offset Base Register < + P2’s limit Limit Register Recap

 Internal Fragmentation

 External Fragmentation

It’s a trade-off between the two

Paging

 Paging uses fixed size units for physical and

virtual memory.

 A single job might get more than one unit

P

Page 1 Page 3 Page 2 Page N Virtual Memory Physical Memory Paging

 Mapping from VM to PM invisible to program

 Must provide protection:

 Program can’t access memory outside its VM

space.

Page Table Illustration Physical memory Page frame Offset Physical Address Page number Offset Virtual Address Page frame Page Table Paging Example

 Pages are 4K

 VPN is 20 bits (2^20 VPNs), offset is 12 bits

 Virtual Address is 0x

 Page number is?

 Offset is?

 Look up page number in page table to get

page frame (let’s say it’s 0x16000)

 What is the PA?

Next time

 Read Chapter 9 (Skim 9.1-9.2)

 Paging

 Segmentation