The code doesn't show exact output
Opened this issue · 0 comments
Deleted user commented
when the process once got allocated,it again searches to another block of size greater.
The modification should be done as given below:
The flag should be used which checks for the process which is already allocated into the block.
int flag1[n];
for(i=0;i<n;i++)
{
flag1[i]=0;
}
for(i=0;i<n;i++){
for(j=0;j<nb;j++) {
if(blockSize[j]>=jobSize[i] && blockSize[j]>0 && flag1[i]==0) {
alloc[i]=j;
flag1[i]=1;
blockSize[j]=blockSize[j]-jobSize[i];
}
}
}