Please answer this question using the detailed steps. input1.txt The output must
ID: 3889415 • Letter: P
Question
Please answer this question using the detailed steps.
input1.txt
The output must look like:
Student Name: Your name
Input File Name : input1.txt
CPU Scheduling Alg : FIFO
Proces 1 is completed at 5 ms
Proces 2 is completed at 12 ms
Proces 3 is completed at 18 ms
Proces 4 is completed at 22 ms
Average Waiting time = 8.75 ms (35/4)
Average Turnaround time = 14.25 ms (57/4)
Throughput = 0.18 jobs per ms (4/22)
Explanation / Answer
#include<stdio.h>
int main()
{
int i,j,n,a[50],frame[10],no,k,avail,count=0;
printf(" ENTER THE NUMBER OF PAGES: ");
scanf("%d",&n);
printf(" ENTER THE PAGE NUMBER : ");
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
printf(" ENTER THE NUMBER OF FRAMES :");
scanf("%d",&no);
for(i=0;i<no;i++)
frame[i]= -1;
j=0;
printf(" ref string page frames ");
for(i=1;i<=n;i++)
{
printf("%d ",a[i]);
avail=0;
for(k=0;k<no;k++)
if(frame[k]==a[i])
avail=1;
if (avail==0)
{
frame[j]=a[i];
j=(j+1)%no;
count++;
for(k=0;k<no;k++)
printf("%d ",frame[k]);
}
printf(" ");
}
printf("Page Fault Is %d",count);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.