The part of the Operating System (OS) which manages memory is known as the memory manager.
Contiguous Memory Allocation
Early Computer Sysems in the beginning were designed for contiguous memory allocation. This meant that each program hat ran and entered in main memory was allocated a single contiguous memory allocation.
Under the multi-programming system that developed laer, it was felt hat it would be better to use non-contiguous memory allocation.
In the case of non-contiguous memory allocation a program is divided into several processes which are placed in main memory in pieces that are not necessarily adjacent to each other. The operating sysem can load and execute a program whenever needed, if the main memory has many small segments free(instead of a single large area).
Partitioned Allocation(Non Contiguous Memory Allocation)
This type of allocation is required and used in a multi-user and muli-programming environment. A major drawback of the single-user or single-program sysem was tha CPU time was wased while the program was performing doing an I/O operation. Multi-program computers were designed in order o make use of the ime during which the CPU was idle. his meant that program had to share the memory available. So, memory go partitioned.
Partitioned allocaion is of two ypes:
Fixed Partition Allocation
A fixed portion of memory is allocated o every program hat enters main memory. The primary disadvantage of fixed partition allocation is hat memory is wasted if it holds a small program. Another disadvantage is that a program of a size larger that the fixed partition cannot enter main memory if the specified number of partitions are no available. The solution for the above problem can be found in variable partition allocation
Variable Partition Allocation
In this kind of allocation, programs are allowed to occupy as much space as they need. this should be lesser than the maximum main memory. Memory is added or removed later as required.
In a multiple programming environment, more than one program runs simultaneously in main memory with variable partition allocation. Small free memory holes are created in main memory when small programs are processed and removed.
Relocation allocation is the technique wherein programs which are already running and available in main memory are relocated, so as to combine these small fragmented areas o form a large memory area.
Virtual memory is a memory management technique developed for multitasking. This technique virtualizes a computer architecture's various forms of computer data storage (such as random-access memory and disk storage), allowing a program to be designed as though there is only one kind of memory, "virtual" memory, which behaves like directly addressable read/write memory (RAM).
Most modern operating systems that support virtual memory also run each process in its own dedicated address space. Each program thus appears to have sole access to the virtual memory.
Systems that employ virtual memory use hardware memory more efficiently than do systems without virtual memory.
Virtual memory makes application programming easier by hiding fragmentation of physical memory; by delegating to the kernel the burden of managing the memory hierarchy (eliminating the need for the program to handle overlays explicitly); and, when each process is run in its own dedicated address space, by obviating the need to relocate program code or to access memory with relative addressing.