Memory Management
Operating System
What is Memory Management ?
RAM
User program
User program
Give memory to user program
What is Memory Management ?
RAM
Finished work
User program
Reclaim Memory after finish the
work
What is Memory Management ?
RAM
User 1 Task
USER 1 Task
User 2 Task
Protecting each user’s memory area
from other user programs
USER 2 Task
Requirements for Memory Management
★ Relocation
★ Protection
★ Sharing
★ Logical Organization
★ Physical Organization
What is Physical Memory ?
❏ Actual RAM of the system
❏ Also called Primary Memory
❏ Directly accessible by CPU
❏ Holds instruction of programs to
execute
RAM
What is Virtual Memory ?
❖ An imaginary memory area supported by some OS in conjunction with
the hardware.
❖ An alternate set of memory addresses.
❖ Programs use these virtual addresses rather than real addresses to
store instructions and data.
❖ The purpose of virtual memory is to enlarge the address space
Kinds of Virtual Memory
The Heap
Allocated Memory
Paged Memory
Segmented Memory
Physical Memory
What is Segmented Memory ?
❖ An address space logically divided into sections, called segments.
❖ A segment has a set of permissions, and a length, associated with it.
❖ Segmented Memory is the additional 64 KB of RAM for early
computers.
❖ But most operating systems today don't use a segmented memory
model, with the advent of paging.
What is Paged Memory ?
A technique used by virtual memory operating systems to help ensure that
the data you need is available as quickly as possible.
What is Swapping ?
❏ To replace pages or segments of data in memory.
❏ Swapping is a useful technique that enables a computer to execute
programs and manipulate data files larger than main memory.
❏ The operating system copies as much data as possible into main
memory, and leaves the rest on the disk.When the operating system
needs data from the disk, it exchanges a portion of data in main memory
with a portion of data on the disk.
Allocated Memory
RAM
User program
User program
Process is called
Memory Allocation
Types of Memory Allocation
Static Memory Allocation
Dynamic Memory Allocation
Static Memory Allocation
int num = 10
RAM
x = 10
Stack
Heap
Dynamic Memory Allocation
char records [ ] = “Large
Data”
RAM
Large data
pointer
Heap
Stack

Memory management

  • 1.
  • 2.
    What is MemoryManagement ? RAM User program User program Give memory to user program
  • 3.
    What is MemoryManagement ? RAM Finished work User program Reclaim Memory after finish the work
  • 4.
    What is MemoryManagement ? RAM User 1 Task USER 1 Task User 2 Task Protecting each user’s memory area from other user programs USER 2 Task
  • 5.
    Requirements for MemoryManagement ★ Relocation ★ Protection ★ Sharing ★ Logical Organization ★ Physical Organization
  • 6.
    What is PhysicalMemory ? ❏ Actual RAM of the system ❏ Also called Primary Memory ❏ Directly accessible by CPU ❏ Holds instruction of programs to execute RAM
  • 7.
    What is VirtualMemory ? ❖ An imaginary memory area supported by some OS in conjunction with the hardware. ❖ An alternate set of memory addresses. ❖ Programs use these virtual addresses rather than real addresses to store instructions and data. ❖ The purpose of virtual memory is to enlarge the address space
  • 8.
    Kinds of VirtualMemory The Heap Allocated Memory Paged Memory Segmented Memory Physical Memory
  • 9.
    What is SegmentedMemory ? ❖ An address space logically divided into sections, called segments. ❖ A segment has a set of permissions, and a length, associated with it. ❖ Segmented Memory is the additional 64 KB of RAM for early computers. ❖ But most operating systems today don't use a segmented memory model, with the advent of paging.
  • 10.
    What is PagedMemory ? A technique used by virtual memory operating systems to help ensure that the data you need is available as quickly as possible.
  • 11.
    What is Swapping? ❏ To replace pages or segments of data in memory. ❏ Swapping is a useful technique that enables a computer to execute programs and manipulate data files larger than main memory. ❏ The operating system copies as much data as possible into main memory, and leaves the rest on the disk.When the operating system needs data from the disk, it exchanges a portion of data in main memory with a portion of data on the disk.
  • 12.
    Allocated Memory RAM User program Userprogram Process is called Memory Allocation
  • 13.
    Types of MemoryAllocation Static Memory Allocation Dynamic Memory Allocation
  • 14.
    Static Memory Allocation intnum = 10 RAM x = 10 Stack Heap
  • 15.
    Dynamic Memory Allocation charrecords [ ] = “Large Data” RAM Large data pointer Heap Stack