FOR FREE YEAR SOLVED

MEMORY MANAGEMENT

 

Introduction

In the case of a uni-programming system, the main memory is divided into two parts: one part for the operating system and one part for the program currently being executed.

 

In a multiprogramming system, the user part of memory must be further subdivided to accommodate multiple processes. The task of the subdivision is carried out dynamically by the operating system and is known as memory management.

 

Memory is managed jointly by the kernel and the run-time library of the programming language in which the code of the process is written. The kernel allocates memory to user processes.

 

 

Goal: Better organization of main memory for user programs which increase the number of process in main memory (which increases CPU utilization) and minimize internal and externa lfragmentation.

 

Functionality: Allocating, de-allocating, reallocating, and protecting the memory for user programs.

 

The main requirement of memory management in multiprogramming

When processes are in the executable mode, it resides at main memory and CPU generally has required three types of memory; main memory (RAM), cache memory, registers to execute the process.

 

As we know register is faster than cache & main memory and cache is faster than main memory.

 

As per access time:  Register > Cache > Main memory.

 

Processing time will be faster and we can get better CPU utilization if we always access data from register or cache.

 

But register and cache are not cost-effective. 

 

As per cost: Register > Cache > Main memory 

 

So, it is better to increase main memory in multi-programming systems and basically, CPU utilization depends on main memory size and efficient memory management.

 

Degree of Multi-programming: The number of executable programs (process) resides in the main memory is countable as the degree of multiprogramming. 

 

For example 1: 

 

We have a main memory of size 8 MB and two processes P1 with size 8 MB and P2 with size 10 MB respectively. As per the main memory size, only process P1 gets the memory.

 

Now, let assume that process P1 is an I/O bounding process  and it requires 70% of I/O work then CPU utilization is 30%.  Because when process P1 busy with I/O work, CPU will be ideal.

 

Example 2: Main memory size 32 MB and we have four processes of size 8 MB.

Here 8 processes can reside in the main memory. Let assume 4 processes are I/O bounding and 4 processes CPU bounding

So, when 4 processes busy with I/O, then there is a chance that another 4 processes busy with CPU then CPU utilization will be high.

 

So, CPU utilization also depends on the degree of multiprogramming i.e. as more processes at the main memory then CPU utilization will be increased.

 

So, one of the main contributions of memory management is to increase the degree of multiprogramming to increase CPU utilization.