In this topic, you will learn about, Memory Management in Multi Programming.
Fixed Partition: In a multiprogramming environment, several programs reside in primary memory at a time and the CPU passes its control rapidly between these programs. One way to support multiprogramming is to divide the main memory into several partitions each of which is allocated to a single process. Depending upon how and when partitions are created
There may be two types of memory partitioning:
Static: A static partition implies that the division of memory into a number of partitions and its size is done in the beginning and remains fixed thereafter.
Dynamic: In dynamic partitioning, the size and the number of partitions is decided during the runtime of the O.S
Both are based on a contiguous allocation of memory.
Static: The Basic approach here is to divide memory into several fixed partitions where each partition will accommodate only one program for exclusion. The number of programs residing in memory will be bound by the number of partitions. When a program terminates that partition is free for another program waiting in the Queue.
Optimal Page Replacement (Belady’s Algorithm): in this technique, we search for an optimal page replacement i.e., it has the lowest page-fault rate and will never suffer from Belady’s Anomaly. The basic concept is that replaces the page that will not be used for the longest period of time. This algorithm guarantees the lowest possible page fault rate for a fixed number of frames.
Unfortunately, the optimal page replacement technique is difficult to implement because it requires future knowledge of the reference string.
Least Recently Used (LRU) Algorithm: if we use the recent past as an approximation of in near future, then we can replace the page that has not been used for the longest period of time. This approach is known as the Least Recently Used (LRU) Algorithm. The Least Recently Used (LRU) replacement associates with each page the time of that page‘s last used. When a page must be replaced Least Recently Used (LRU)chooses the page that has not been used for the longest period of time.
The Least Recently Used (LRU) does not suffer from Belady’s Algorithm.