Lecture 14 Memory Management III - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Lecture 14 Memory Management III

Description:

The number, location, and size of the partitions vary dynamically as ... units, perhaps as small as few words and perhaps as large as several kilobytes ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 16
Provided by: eam80
Category:

less

Transcript and Presenter's Notes

Title: Lecture 14 Memory Management III


1
Lecture 14 Memory Management III
  • Variable Partition Allocation

2
Variable Partitions
  • The number, location, and size of the partitions
    vary dynamically as processes come and go
  • Improves memory utilization. Process is allocated
    exactly as much memory as required
  • The number and size of the processes in memory
    vary dynamically throughout the day
  • Complicates allocating and deallocating memory

3
Example
4
External fragmentation problem
OS
320 K
Process 1
224 K
Process 3
288 K
64 K
5
Solution Compaction
OS
320 K
Process 1
128 K
Process 4
288 K
Process 3
100K
Process 5
60K
6
Placement algorithms revisited
  • Best-fit
  • Chooses the block that is closest in size to the
    request
  • worst performer overall
  • since smallest block is found for process, the
    smallest amount of fragmentation is left memory
    compaction must be done more often

7
Placement algorithms revisited
  • First-fit
  • Begins to scan memory from the beginning and
    chooses the first available block that is large
    enough
  • fastest
  • may have many process loaded in the front end of
    memory that must be searched over when trying to
    find a free block

8
Placement algorithms revisited
  • Next-fit
  • Begins to scan memory from the location of the
    last placement and chooses the next available
    block that is large enough.
  • more often allocate a block of memory at the end
    of memory where the largest block is found
  • the largest block of memory is broken up into
    smaller blocks
  • compaction is required to obtain a large block at
    the end of memory

9
Placement algorithmsExample
10
Memory Managementwith Bit Maps
  • Memory is divided up into allocation units,
    perhaps as small as few words and perhaps as
    large as several kilobytes
  • Corresponding to each allocation unit is a bit in
    the bit map, which is 0 if the unit is free and 1
    if it is occupied
  • A bit map provides a simple way to keep track of
    memory words in a fixed amount of memory because
    the size of the bit map depends only on the size
    of memory and the size of the allocation unit

11
Memory Managementwith Bit Maps
12
Memory Managementwith Linked Lists
  • Another way of keeping track of memory is
    maintaining a linked list of allocated and free
    memory segments.
  • A segment is either a process or a hole between
    two processes

13
Memory Managementwith Linked Lists
14
Memory Managementwith the Buddy System
  • Available blocks of size 2k, L k U
  • 2L is the smallest block that is allocated
  • 2U is the largest size block that is allocated
  • To begin, the entire space available for
    allocation is treated as a single block of size
    2U
  • if a request of size s such as 2U-1 lt s 2U is
    made, then the entire block is allocated
  • Otherwise, the block is split into two equal
    buddies of size 2U-1.
  • (The process is repeated)

15
Memory Managementwith the Buddy System
Write a Comment
User Comments (0)
About PowerShow.com