It is part of computer which stores data the memory is important resource of computer which should manage carefully. The speed of computer system depends on speed of computer and way of managing different types of memory in computer system. Memory management in system is performed by operating system. The part of operating system that manages the memory is called memory manager. The main task of memory manager is to keep track of which parts of memory are used or which part is not used, which location is to allocate for process and when the process complete, how to de-allocate the main memory etc. another task is to swap between main memory and disk when main memory is too small to hold data.
The speed, storage, capacity, cost, volatile or non-volatile,feature of memory depends on purpose of memory. Computer system use memory with a small amount of storage capacity, very fast speed. Most expensive which is cache memory. Some computer also use medium speed, medium price and medium storage capacity. Which is ram as main memory. Some computer also use the memory which have very high storage capacity, slow, cheap and non-volatile memory. Which is known as secondary storage. So,memory hierarchy is known as hierarchy of such different types of memory. The job of operating system is to manage or co-ordinate how these memories are used.
Basic Memory Management Techniques:
Memory management can be divided into two classes these that more processes back and forth between main memory and disk during execution. More process back and fourth between main memory and disk is known as swapping and paging.
a. Mono programming without swapping or paging:-
This is the simplest memory management in which just one program is run at a time, sharing the memory between the program and the operating system. Three variables are used in this schemes.
1. The operating system may be at the bottom of memory in ram.
2. The operating system may be in ROM at top of memory.
3. Device driver may be at the top of the RAM.
This model is used in ms-dos system. In this type of system only one process ata a time can be operated or executed. As soon as user type command the operating system copies the request program from the disk to the memory and execute it when the processes finishes, the operating system displays the prompt character and wait for a new command when it receive the command , it load a new program in memory and overload the first one.
b. Multiprogramming with fix partition:
It is often useful to have more than one process in memory at a time. The partitioning can be done manually by the operator. When the system to started up when the job carries, it can be put into the input queue for the small partition large enough to hold it. Since the partition are fixed any space in two partition not used by a job is lost. The difference between fixed memory partition with separate input queues and single input queue can be shown as
The disadvantage of sorting the incoming job into separate queues becomes apparent when the queues for large partition is empty out the queue for small partition is full. But in care of single queues, whenever partitioning becomes free, the job closest to front of the queue that fits in it could be loaded into empty partition and run.
Virtual memory is a very important concept of modern multiprogramming system when the programs are large and memory is insufficient to hold whole program at once in memory.
Many years ago, scientists confronted with program that were too big to fit in the available memory. The solution usually adopted was to sit the program into pieces, called overlays. Overlays would start running first when it was done it would call another overlay. Although the actual work of swapping overlays in and out was done by the system. The work of splitting program into pieces had to be done by the programmer that job was to discus was boring.
In 1961, a method was devised to ever come above problems and called as virtual memory. The basic idea behind virtual memory is that the combined size of the program, data and stack may exceed the amount of physical memory available for it. The operating system keeps those parts of program concurrently in use in main memory and the root on the disk. For example a 16-mb program can run on 4 mb machine by carefully choosing which 4 mb to keep in memory at each instant with pieces of the program being swapped between disk and memory. As needed most virtual memory system use paging concept.
Most virtual memory system use a technique called paging. On any computer, there exist a set of memory address that programs can produce.
The program generated addresses are called virtual address and forms the virtual address space. This address can be generated using indexing, base register, segment register and other ways. On computer’s without virtual memory, the virtual address is put directly onto the memory bus and causes the physical memory work with the same address to be read and written. When virtual memory is used, the virtual addresses do not go directly to memory bus. Instead, they go to memory management unit (MMU) that maps the virtual addresses onto physical memory addresses.
The virtual memory is divided up into units called pages. The corresponding unit in the physical memory is called page frames. The page and page frames has always same size.
a. Single level page table:- the working of a single level page table can be defined by considering MMu . how it works and why we have chosen to work a page size that is power of 2.
b. Multilevel page table:- to solve the problem of having huge page tables in memory all the time, may computers use a multilevel page table. Today’s computer’s and software’s generate 32 bit address which forms 44B of virtual memory address space. So, 32 bits divided into 3 parts in the page table as:
Offset= 12 bits
In time sharing and multiprogramming environment, there are many process running simultaneously in the system. The memory of the system may not be enough to hold all the process at a time. So,. The processes are being into main memory and run it. And again it keep back to disk. So , bringing a process from disk to primary memory, execute it and again keep back to disk is called swapping.
The partition in this method are variable in size but main problem in this allocating and de allocation memory and keeping track of it.
The main difference between fix partition and variable partition is that the number of location and size of position vary dynamically in the memory. The flexibility is not being filed to a fixed number of partitions that may be too large or too small memory utilisation but the main problem is allocating and de allocating of memory, as well as keeping track of it.
It is possible combine all the holes into one big on by moving all the process as downward as far as possible. This technique is known as memory compaction.
- Introduction to operating system Operating System: An operating system is a collection of system...
- Types of operating systems An operating system can also be divided into many types...
- Operating System Structure operating system structure: An operating system might have many structure....
- Introduction to Processes in operating system Early computer system allowed any one program to be...
- process model The software and large program is organized into a number...