Chapters 7 & 8 Memory Management: Operating Systems: Internals and Design Principles, 6/E
Chapters 7 & 8 Memory Management: Operating Systems: Internals and Design Principles, 6/E
Chapters 7 & 8
Memory Management
Patricia Roy
Manatee Community College, Venice, FL
©2008, Prentice Hall
Memory Management
• Subdividing memory to accommodate
multiple processes
• Addressing
• Protection
• Relocation
• Efficiency: reasonable supply of ready
processes to achieve a high level of
multiprogramming
Addressing Requirement
Addresses
• Relative
– Address expressed as a location relative to
some known point, e.g., 10th instruction in
code
• Physical or Absolute
– The absolute address or actual location in
main memory
Registers Used during Execution
• Base register
– Starting address for the process
• Bounds register
– Ending location of the process
• These values are set when the process is
loaded or when the process is swapped in
Calculating Absolute Address
• The value of the base register is added to
a relative address to produce an absolute
address
• The resulting address is compared with
the value in the bounds register
• If the address is not within bounds, an
interrupt is generated to the operating
system
Translation
Relocation
• Relocation
– Programmer does not know where the
program will be placed in memory when it is
executed
– While the program is executing, it may be
swapped to disk and returned to main
memory at a different location (relocated)
– Memory references in the code must be
translated to actual physical memory address
Protection
• Protection
– Processes should not be able to reference
memory locations in another process without
permission
– Impossible to check absolute addresses at
compile time
– Must be checked at run time
Sharing
• Sharing
– Allow several processes to access the same
portion of memory
– Better to allow each process to access the
same copy of the program rather than have
their own separate copy
Modules
• Logical Organization
– Programs are written in modules
– Modules can be written and compiled
independently
– Different degrees of protection given to
modules (read-only, execute-only)
– Share modules among processes
Fixed Partitioning