Академический Документы
Профессиональный Документы
Культура Документы
Systems:
Internals
and Design Chapter 7
Principles Memory
Management
Seventh Edition
William Stallings
Memory Management
Requirements
• Memory management is intended to satisfy the
following requirements:
• Relocation
• Protection
• Sharing
• Logical organization
• Physical organization
Physical Organization
– Assign each process to the smallest partition within which it will fit
– Queue for each partition
– Processes are assigned in such a way as to minimize wasted
memory within a partition
“Unequal size portioning”.
Logical
Relative
Physical or Absolute
Real memory
• main memory, the actual RAM
Virtual memory
• memory on disk
• allows for effective multiprogramming and relieves the user
of tight constraints of main memory
Thrashing
A state in which
the system spends
most of its time
swapping process
pieces rather than
executing To avoid this, the
instructions operating system tries
to guess, based on
recent history, which
pieces are least likely to
be used in the near
future
Principle of Locality
• Contemporary programming
techniques (OO & multi-threading)
used in large programs tend to most obvious on
decrease the locality of references personal computers
within a process where applications are
becoming increasingly
complex
Basic Algorithms
Algorithms used for the selection of a page to
replace:
1. Optimal
Replace the page that won’t be needed for the longest time in the
future
2. Least recently used (LRU
Replace the page that hasn’t been referenced for the longest time
3. First-in-first-out (FIFO)
4. Clock
Clock hand sweeps over pages looking for
one with used bit = 0
Replace pages that haven’t been referenced for
one complete revolution of the clock
Replacement policies
Replacement policies
Replacement policies
Clock Policy
Summary
• Desirable to:
– maintain as many processes in main memory as possible
– free programmers from size restrictions in program
development
• With virtual memory:
– all address references are logical references that are translated
at run time to real addresses
– a process can be broken up into pieces
– two approaches are paging and segmentation
– management scheme requires both hardware and software
support