November 28, 2024

Types of Memory Management /Uniprogramming /Multiprogramming

Uniprogramming

  • This is the simplest technique having just one process in memory at a time and allowing that process to use all of the memory.
  • The user loads the entire memory with a program from a disk or tape and it takes over the whole machine.
  • This technique is used on a simple microcomputer.
  • The main advantage of this technique is that keeping track of memory is easy as all memory is allocated to only one job, and there is no complexity in scheduling.
  • When the job is finished, the entire memory is returned to free status. it is fast and concurrency control is not required.
Fig:- Uniprogramming

Multi-programming with fixed  partitioning(static)

  • One way to support multiprogramming is to divide the main memory into several partitions each of which is allocated to a single process. This is known as partitioning.
  • Partitions are created during the system generation process. The size and number of partitions are always fixed.
  • For a multi-programming environment, several programs should reside in memory at a time and The CPU should pass its controls repeatedly between all these programs.
  • The basic approach of fixed partitioning is to divide the memory into several fixed-size partitions where each partition will accommodate only one program for execution.
  • So the degree of multiprogramming (i.e number of programs residing in memory) will not be greater than the number of partitions.
  • When a program terminates that partitions become free for another process waiting in the queue
  • In equal-size partitioning, a program may be too big to fit into a partition,  so it could take more than one partition.
  • In unequal size partitioning, it provides efficient memory utilization by having to choose the partition in a nearer size.
  • The figure shows 7-partition with 3 processes allocated and three unused blocks.
  • The memory manager keeps track of these partitions in a special type of  data structure called a partition description table(PDT)
  • The PDT for the above memory partition is shown below

The drawback of Static partition.

  • It fetches internal fragmentation. It occurs when the process of a smaller size than the size of the partition gets allocated in the partition leaving some fragmented space unused.
  • The degree of multiprogramming will never exceed the number of partitions.
  • Low memory utilization.

Multi-programming with dynamic partitioning:

  • The main problem with fixed partitioning is the wastage of memory by programs that are smaller than their partitions when allocated. so to overcome this problem, a different memory management approach is used which is known as dynamic or variable size partitioning.
  • It creates partitions dynamically to meet the requirements of each requesting process.
  • When a process terminates or becomes swapped out, the memory manager can return the vacant space to the pool of free memory areas from which further partition allocations are made.
  • Compared to fixed partitioning, in dynamic partitioning, neither the size nor the number of partitions needs to be limited at any time.
  • Memory manager continuously creates and allocates partitions for requesting processes until all physical memory is exhausted or the maximum allowable degree of multiprogramming is reached.
  • The flexibility of not being tired to a fixed number of partitions.
  • Improve memory utilization, but on the other hand, it also complicates the process of allocation and de-allocation of memory partitions.
  • Eventually, it leads to a situation in which there are a lot of small holes in memory. As time goes on memory becomes more and more fragmented, and memory utilization declines. This phenomenon is referred to as external fragmentation.

Advantages of Dynamic partitioning:

  • High memory utilization because of no internal fragmentation.
  • The number of programs that could reside in memory is generally larger.
  • Processes of any size can get allocated in memory if there is enough memory space.

Disadvantages of Dynamic partitioning:

  • External fragmentation is a major problem, so compaction is required which is very difficult to implement.
  • It requires a lot of extra time, space, and a complex memory management algorithm.

Leave a Reply

Your email address will not be published. Required fields are marked *