What is memory management?
Memory management as the name implies management of computer’s physical memory or Random access memory (RAM). The primary purpose of doing memory management to dynamically distribute memory across all running processes to ensure optimal performance. As each computer has preinstalled main memory that is used for running applications so no matter how great the memory capacity is, it cannot entertain all the running process simultaneously. Basically this is the process of controlling and coordinating computer memory by assigning some of the portion (blocks) of the main memory to the running process or application. When the program request for the block of memory then the allocator assign memory block of the required size to the program.
Memory management requirements
Memory management should satisfy the following requirements:
- Relocation: The role of relocation to execute process independently from their physical location in memory. Virtually all the techniques in this filed rely on the ability to relocate process efficiently. The need for relocation is immediately evident when one considers that in a general-purpose multiprogramming environment a program cannot know in advance what process will be running in memory when it is executed, nor how much memory the system has available for it, nor where it is located. So the program must be compiled and linked in a way that it can be loaded starting from an unpredictable address in memory, an address that can even change the execution of the process itself, if any swapping occur.
- Sharing: Protection mechanism must have the flexibility to allow several processes to access the same portion of the main memory. Let’s take an example to understand sharing requirement if the number of process are executing the same program then it is advantageous to allow each process to access the same copy of the program rather than its own separate copy.
- Protection: When we have two program at the same time there is a danger that one program can write to the address space of another program so in the manner every process should be protected against unwanted interference by other processes. Satisfaction of the relocation requirement increase the difficulty of satisfying the protection requirement. CPU tend to support absolute addressing which means that code runs differently when loaded in different places. This is not possible to check the absolute address at the compile time. Most of the programming languages allow the dynamic calculation of the address at run time.
- Logical organization: As user write program in modules with different characteristics then logical organization be like instruction modules are execute-only, data modules are either read-only or read/write and some modules are private other are public. To effective deal with the user program, the operating system and hardware must support a basic form of module to provide the required protection and sharing.
- Physical organization: As we know computer memory is organized into two levels main and secondary memory. Main memory is a volatile which provide fast access at relatively high cost and secondary memory is non-volatile which is going to provide slower and cheaper access than main memory. The flow of information is mainly between main memory and secondary memory which is major system concern but sometimes it is impractical for the programmers understand how. As main memory is available for the program and for data also which may be insufficient for that programmer must use mechanism of overlaying that hold the data and program that are needed at the given time. There is also another factor that going to affect programmer concern that is multiprogramming environment. In such environment, programmer does not know how much space is available.
Memory Management Techniques
Now we are going to discuss techniques for memory management. They are mainly of two types Real memory management and Virtual memory management. Get help to know more about memory management techniques and how the techniques are going to make a better effective system know about this from expert online tutors they are going to solve your queries related to memory management techniques. Click here to submit your requirement.
Real Memory Management
In real memory management operating systems is responsible for managing the space of the main memory. Real memory management done by two ways Mono Programming System which execute a program at a time and memory is also divided into two parts one is to save OS and another one is to save program. Another one is Multiprogramming System in which more than one program executed at the same time and memory space is shared by several processes. When all the processes are executed completely then they take out from the memory.
Virtual memory Management
This is the technique that allow execution of the processes done via transparent scheme which is not completely available in the memory. One of the main advantage of this memory is that program can be large in size than the physical memory as provide the separation of user logical memory from physical memory. There are three techniques of virtual memory management that are commonly in use. Very first is Paging Method the technique setup enough memory space for each process by making secondary storage as extension to main memory. In this virtual page is divided into several pages and every page has the same size. Second one is Segmentation Method which provide last size of virtual memory that divide into multidimensional memory that is known by segments. The method will allow programmer to view memory as different segments containing multiple address space. But this is not necessary that each segment is of same size it may be of different size. Last one is Paging and Segmentation Method this take the advantage of both paging and segmentation method. In which virtual memory is multidimensional that provide many segments and each segment has a large size.