Tuesday 23 September 2014

Program for MVT


In MFT, a program had to wait until a partition of suitable size was available even though theavailable memory might be enough to accommodate it.A variant called Multiprogramming with Variablenumber of Tasks (MVT) was introduced.In this, the regions were not frozen at startup, but weredynamically made available to the program upon request.Fig.1.8 below illustrates this concept by showingthe memory map at two different instants of time.
Fig. 1.8 Illustration of MVT
1.3.7 Operating System / Virtual Storage (OS/VS 1)
A program can be loaded in a contiguous space in central memory. All the operating systemsabove suffered from the limitation that the maximum size of any program was restricted by the size ofCentral Storage.Also, another problem is that of unusable memory areas due to memory fragmentation.
Fig. 1.9 Illustration of OS/VS1
To overcome these problems, IBM introduced Operating System/Virtual Storage 1 (OS/VS1)which was an enhancement on MFT. This is like MFT, but the partitions are created in virtual address thanin real address.In this OS, the operator assigned virtually contiguous partitions. This virtual storage is backup in Central Storage and on auxiliary disk storage. The operating system takes care of bringing in portionsof the program from disk into Central Storage as needed.
Another variant of OS/VS1 called OS/ VS2 Single Virtual Storage (OS/VS2 SVS) was released.This was an enhancement of MVT with the addition of virtual storage.This freed the operating system, asdid MVT, from the problem of locating a suitable partition to run the program.

In SVS, like in OS/VS1, the programs are relocatable, i.e. they can be placed anywhere in memory





#include<stdio.h>
#include<conio.h>
void main()
{
int m=0,m1=0,m2=0,p,count=0,i;
clrscr();
printf("Enter the memory capacity:");
scanf("%d",&m);
printf("Enter the no of processes:");
scanf("%d",&p);
for(i=0;i<p;i++)
{
printf("\nEnter memory req for process%d: ",i+1);
scanf("%d",&m1);
count=count+m1;
if(m1<=m)
{
if(count==m)
{
printf("There is no further memory remaining:");
}

else
{
printf("The memory allocated for process%d is: %d ",i+1,m);
m2=m-m1;
printf("\nRemaining memory is: %d",m2);
m=m2;

}
}
else
{
printf("Memory is not allocated for process%d",i+1);
}
printf("\nExternal fragmentation for this process is:%d",m2);
}
getch();
}



OUTPUT

1 comment:

  1. Thank you for your articles that you have shared with us. Hopefully you can give the article a good benefit to us. Counselor for Alcoholics San Francisco

    ReplyDelete