ECE344-Lecture14-Memory Management

ECE344-Lecture14-Memory Management - Lecture 14: Memory...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 14: Memory Management David Lie ECE344 University of Toronto
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ECE344: Operating Systems Outline Introduction to memory management – Fragmentation – Paging Hardware Support – Virtual Memory Translation – Page Tables – Linear, Multi-level and inverted Page Tables Memory Resource Tracking: Bitmaps and Linked lists The Coremap The Address space structure The stack, the heap and sbrk()
Background image of page 2
3 ECE344: Operating Systems Memory Resource Tracking One of the basic tasks of memory management is tracking what memory is allocated (used) and what memory is free (unused) Abstraction: – Program requests memory (malloc/kmalloc) – Program frees memory (free/kfree) Goal here is to partition memory within an address space: – Memory management system should be able to return any size chunk of memory requested as long as the total requested chunk adds up to less than available memory
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 ECE344: Operating Systems Tracking Memory With Bitmaps A Bitmap is a long bit string One bit for every page of memory – 1 = in use – 0 = free Size of page determines size of bitmap – Page size = 32 bits • Overhead for bitmap = 1/(32 + 1) = 3% – Page size = 4 KB • Overhead for bitmap = 1/(4 * 1024 * 8 + 1) = 1 / 32769 Larger the page size, the lower the overhead. What’s the downside of a large page size?
Background image of page 4
5 ECE344: Operating Systems Bitmap Operations mem = allocate(K) – Search bitmap for K consecutive 0 bits – Set the K bits to 1 free(mem, K) – Determine starting bit in bitmap based on memory address – Set next K bits to 0 Cost – Linear search
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 ECE344: Operating Systems Managing Memory With Linked Lists Bitmaps have a fixed overhead regardless of how memory is used: – Link lists provide an alternative that uses less memory when memory is lightly used, or used in large chunks Keep a list of elements, each describing a partition of memory
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

ECE344-Lecture14-Memory Management - Lecture 14: Memory...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online