Tuesday, 9 August 2016

what is memory management

                                                     Main Memory  The main working principle of digital computer is Von-Neumann stored p... thumbnail 1 summary
                                                    Main Memory 

The main working principle of digital computer is Von-Neumann stored program principle. First of all we have to keep all the information in some storage, mainly known as main memory, and CPU interacts with the main memory only. Therefore, memory management is an important issue while designing a computer system. On the otherhand, everything cannot be implemented in hardware, otherwise the cost of system will be very high. Therefore some of the tasks are performed by software program. Collection of such software programs are basically known as operating systems. So operating system is viewed as extended machine. Many more functions or instructions are implemented through software routine. The operating system is mainly memory resistant, i.e., the operating system is loaded into main memory. Due to that, the main memory of a computer is divided into two parts. One part is reserved for operating system. The other part is for user program. The program currently being executed by the CPU is loaded into the user part of the memory. In a uni-programming system, the program currently being executed is loaded into the user part of the memory. In a multiprogramming system, the user part of memory is subdivided to accomodate multiple process. The task of subdivision is carried out dynamically by opearting system and is known as memory management. 






Efficient memory management is vital in a multiprogramming system. If only a few process are in memory, then for much of the time all of the process will be waiting for I/O and the processor will idle. Thus memory needs to be allocated efficiently to pack as many processes into main memory as possible. When memory holds multiple processes, then the process can move from one process to another process when one process is waiting. But the processor is so much faster then I/O that it will be common for all the processes in memory to be waiting for I/O. Thus, even with multiprogramming, a processor could be idle most of the time. Due to the speed mismatch of the processor and I/O device, the status at any point in time is reffered to as a state. There are five defined state of a process as shown in the figure. When we start to execute a process, it is placed in the process queue and it is in the new state. As resources become available, then the process is placed in the ready queue.



To utilize the idle time of CPU, we are shifting the paradigm from uniprogram environment to multiprogram environment. Since the size of main memory is fixed, it is possible to accomodate only few process in the main memory. If all are waiting for I/O operation, then again CPU remains idle. To utilize the idle time of CPU, some of the process must be off loaded from the memory and new process must be brought to this memory place. This is known swapping. What is swapping : 

1. The process waiting for some I/O to complete, must stored back in disk. 

2. New ready process is swapped in to main memory as space becomes available. 

3. As process completes, it is moved out of main memory. 

4. If none of the processes in memory are ready,

 ■ Swapped out a block process to intermediate queue of blocked process. 

■ Swapped in a ready process from the ready queue. But swapping is an I/O process, so it also takes time. Instead of remain in idle state of CPU, sometimes it is advantageous to swapped in a ready process and start executing it. The main question arises where to put a new process in the main memory. It must be done in such a way that the memory is utilized properly



No comments

Post a Comment