Untitled

 avatar
unknown
plain_text
8 months ago
585 B
2
Indexable
#include<stdio.h>
int main()
{
int  i,j;
int  bno,pno,bs[20],ps[20];
printf("enter the no of  blocks");
scanf("%d",&bno);
printf("enter the no of process");
scanf("%d",&pno);
for(i=0;i<bno;i++)
{
printf("enter the %d  st blocksize",i+1);
scanf("%d",&bs[i]);
}
for(i=0;i<pno;i++)
{
printf("enter the%d st processsize",i+1);
scanf("%d",&ps[i]);
}
for(i=0;i<bno;i++)
{
for(j=0;j<pno;j++)
{
if(ps[j]<=bs[j])
{
printf("the process %d allocated to %d",j,bs[i]);
ps[j]=10000;
break;
}
}
}for(j=0;j<pno;j++)
{
if(ps[j]!=10000)
{
printf("the process %d is not allocated \n",j);
}
}return 0;
}

Editor is loading...
Leave a Comment