Chapter 6 Memory Management
Chapter 6 Memory Management
Management
Memory
Management
Terms
Memory Management
Requirements
Memory management is intended to satisfy
the following requirements:
Relocation
Protection
Sharing
Logical organization
Physical organization
Relocation
Programmers typically do not know in advance which other
programs will be resident in main memory at the time of execution
of their program
Active processes need to be able to be swapped in and out of
main memory in order to maximize processor utilization
Specifying that a process must be placed in the same
memory region when it is swapped back in would be
limiting
may need to relocate the process to a different
area of memory
Addressing Requirements
Protection
Processes need to acquire permission to reference memory locations
for reading or writing purposes
Location of a program in main memory is unpredictable
Memory references generated by a process must be checked at run
time
Mechanisms that support relocation also support protection
Sharing
Advantageous to allow each process access to the same copy
of the program rather than have their own separate copy
Memory management must allow controlled access to
shared areas of memory without compromising protection
Mechanisms used to support relocation support sharing
capabilities
Logical Organization
Memory is organized as linear
External Fragmentation
• memory becomes more and more fragmented
• memory utilization declines
Compaction
• technique for overcoming external
fragmentation
• OS shifts processes so that they are contiguous
• free memory is together in one block
• time consuming and wastes CPU time
Placement Algorithms
Relative
• address is expressed as a location relative to some
known
point (a particular example of logical address)
Physical or Absolute
• actual location in main
memory
Partition memory into equal fixed-size chunks (termed frames)
that are relatively small
Process is also divided into small fixed-size chunks (termed
pages)
of the same size
Pages Frames
• chunks of a • available
process chunks of
memory
Assignment of
Process to
Free Frames
Page Table
Maintained by operating system for each process
Contains the frame location for each page in the process
Processor must know how to access for the current
process
Used by processor to produce a physical address
Data Structures
Logical Addresses
Logical address
= page # + offset within page
16-bit address