Swapping:-
Swapping is a system by which use the memory efficiency mostly in time sharing system. In swapping system inactive process are kept on the backing storage, whenever required the process is allocated a time slice and process is laded into memory on computer of time slice or when process is waiting for user to response again, the process is transferred back to the backing storage.
There are two types of swapping system.
1. Simple swapping
2. Complex swapping
1. Simple swapping:-
In this system the main memory is large enough to just the operating system and enough user process and all the processes take to be swapped into a single space when they are allocated a time slice. The time for each process interaction is a follow:
Time of each interaction =Swap in time + CPU time + Swap out time = 2 * Swap time + CPU time Where swap in is the time takes by the computer to load a program from backing storage to main storage and swap out time is the time taken by computer to transfer back a program from main memory to backing storage.
By using simple swapping system we can use a small storage efficiently but main problem is that CPU is under utilized i.e. large amount of time is wasted in swap in and swap out of a program.
Thus another technique called complex sapping is used to over come the CPU under utilization.
2. Complex Swapping:-
In complex swapping when process is in main storage for processing, at the same time the next process I +1 is coming to the main storage for processing while the previous one is going at the same time, by doing so we can increase the efficiency of CPU. Thus in this system CPU will not have to want for the process of swap in or swap out, which increase the utilization of CPU. So by this system we increase the efficiency of CPU as complex to simple swapping system.
Fragmentation:-
Fragmentation is a memory management problem which occurs during swapping of process in a swapping system. When process is swap out, they left behind a free space in the memory these space are of variable length so when the process is going to be transferred its free space can not be utilized completely.
If the incoming process contains 5 KB and total space is 8 KB in these partitions as follow:
But still program cannot be loaded into the main memory although total space is greater then program space. So it causes is fragmentation called external fragmentation. Now if we have a process of 5 KB and space in partition is 8 KB, then 3 KB is left which is cannot be used for any process which cause internal fragmentation.
Segmentation:-
In memory fragmentation problem we have seen that the main memory of computer system become fragmented due to swapping of programs. The new program could not be loaded into memory though available free space is greater then program is purely planed, then we can divide the program into different segments which are certainly be smaller then complete program, and these small pieces would be better able to for into the small opening in the main store. Thus we can see that the division of virtual memory into logical memory area is called segmentation. Memory is divided into logical segments and item of the process having similar characteristics are placed in the same segment. Operating system keep segment take of all these segments which have base lentil values of each segment. A segment of process is loaded for execution when it is required one advantage of segment is that segments can be shared among different process. The information about segments in the segment table is stored sequentially.
Paging System:-Swapping:-
Swapping is a system by which use the memory efficiency mostly in time sharing system. In swapping system inactive process are kept on the backing storage, whenever required the process is allocated a time slice and process is laded into memory on computer of time slice or when process is waiting for user to response again, the process is transferred back to the backing storage.
There are two types of swapping system.
1. Simple swapping
2. Complex swapping
1. Simple swapping:-
In this system the main memory is large enough to just the operating system and enough user process and all the processes take to be swapped into a single space when they are allocated a time slice. The time for each process interaction is a follow:
Time of each interaction =Swap in time + CPU time + Swap out time = 2 * Swap time + CPU time
Where swap in is the time takes by the computer to load a program from backing storage to main storage and swap out time is the time taken by computer to transfer back a program from main memory to backing storage.
By using simple swapping system we can use a small storage efficiently but main problem is that CPU is under utilized i.e. large amount of time is wasted in swap in and swap out of a program.
Thus another technique called complex sapping is used to over come the CPU under utilization.
2. Complex Swapping:-
In complex swapping when process is in main storage for processing, at the same time the next process I +1 is coming to the main storage for processing while the previous one is going at the same time, by doing so we can increase the efficiency of CPU. Thus in this system CPU will not have to want for the process of swap in or swap out, which increase the utilization of CPU. So by this system we increase the efficiency of CPU as complex to simple swapping system.
Fragmentation:-
Fragmentation is a memory management problem which occurs during swapping of process in a swapping system. When process is swap out, they left behind a free space in the memory these space are of variable length so when the process is going to be transferred its free space can not be utilized completely.
If the incoming process contains 5 KB and total space is 8 KB in these partitions as follow:
But still program cannot be loaded into the main memory although total space is greater then program space. So it causes is fragmentation called external fragmentation. Now if we have a process of 5 KB and space in partition is 8 KB, then 3 KB is left which is cannot be used for any process which cause internal fragmentation.
Segmentation:-
In memory fragmentation problem we have seen that the main memory of computer system become fragmented due to swapping of programs. The new program could not be loaded into memory though available free space is greater then program is purely planed, then we can divide the program into different segments which are certainly be smaller then complete program, and these small pieces would be better able to for into the small opening in the main store. Thus we can see that the division of virtual memory into logical memory area is called segmentation. Memory is divided into logical segments and item of the process having similar characteristics are placed in the same segment. Operating system keep segment take of all these segments which have base lentil values of each segment. A segment of process is loaded for execution when it is required one advantage of segment is that segments can be shared among different process. The information about segments in the segment table is stored sequentially.
Paging System:-
The division of virtual memory into fixed length memory areas is called paging techniques. Each memory area is called a page. To avoid fragmentation paging is another technique. In paging system the virtual memory is divided into fixed length physical memory areas. These fixed length physical memory areas are called pages; user process is stored in these pages.
Information of the pages are stored sequentially, so to address a memory location in a particular pages, it is referenced through relative to the start address of that page so to access a memory location in a page, first page is accessed through page table in the real memory of the page then address of the memory location in referenced and used. A full page is loaded from virtual memory to real memory and is executed.
The division of virtual memory into fixed length memory areas is called paging techniques. Each memory area is called a page. To avoid fragmentation paging is another technique. In paging system the virtual memory is divided into fixed length physical memory areas. These fixed length physical memory areas are called pages; user process is stored in these pages.
Information of the pages are stored sequentially, so to address a memory location in a particular pages, it is referenced through relative to the start address of that page so to access a memory location in a page, first page is accessed through page table in the real memory of the page then address of the memory location in referenced and used. A full page is loaded from virtual memory to real memory and is executed.
Posted by: Wasim Javed
No comments:
Post a Comment