CHAP5 Memory management (Cairo Univ)
CHAP5 Memory management (Cairo Univ)
Chapter 7
By: Hatem Moharram
Memory Management
• there is never enough main memory to hold all of the
programs and data structures needed by active
processes and by the operating system.
1. Relocation
2. Protection
3. Sharing
4. Logical organization
5. Physical organization
7.1 MEMORY MANAGEMENT REQUIREMENTS
1- Relocation
Programmer does not know where the program will be
placed in memory when it is executed.
The OS should be able to swap active processes in and out
of main memory to maximize processor utilization by
providing a large pool of ready processes to execute.
While the program is executing, it may be swapped to disk
and returned to main memory at a different location
(relocated)
some technical concerns related to addressing.
Memory references must be translated in the code to
actual physical memory address
the processor must deal with
memory references within the
program.
2- First-fit algorithm
begins to scan memory from the beginning and chooses
the first available block that is large enough.
– the simplest
3- Next-fit
Begins to scan memory from the location of the last
placement, and chooses the next available block that is
large enough.
• Relative
– is a particular example of logical address
– address expressed as a location relative to some
known point
• Physical
– the absolute address or actual location in main
memory
a hardware mechanism is needed for translating relative
addresses to physical main memory addresses at the time
of execution of the instruction that contains the reference.
Registers Used during Execution
• Base register
– starting address for the process
• Bounds register
– ending location of the process