Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can you answer #6 Say the currently running process has 16 active pages, P0-P15,

ID: 3849354 • Letter: C

Question

can you answer #6

Say the currently running process has 16 active pages, P0-P15, all of which have their reference bits set to 1. If the operating system uses the clock algorithm for page replacement, the pages are ordered numerically around the clock" (P0 is first, P1 is second, etc), and the "clock hand" currently points to P6, which page will be replaced if a frame is needed to bring in a new page? Explain your answer for full credit. A portion of the currently running process's page table is shown below. Assume the system uses 20-bit addresses and 16 KB pages. The process accesses four addresses: 0x25FEE, 0x2B149, 0x30ABC, and 0x 3170F. Determine (i) which address would cause a page to be evicted if there were no free physical frames, (ii) which one would mark a previously clean page as modified, if the access were a write, and (iii) which one accesses a page that has not been referenced for many cycles. For full credits, show all work.

Explanation / Answer

#include<stdio.h>
int main()
{
int n,p[100],f[10],ava,hit=0,usebit[10],i,j;
printf("enter the length of ");
scanf("%d",&n);
printf("enter the reference string: ");
for(i=0;i<n;i++)
scanf("%d",&p[i]);
for(i=0;i<n;i++)
{
ava=0;
// found
for(j=0;j<3;j++)
{
if(p[i]==f[j])
{
ava=1;
hit++;
usebit[j]=1;
break;
}
}
//search for usebit 0
if(ava==0)
{
for(j=0;j<3;j++)
{
if(usebit[j]==0)
{
f[j]=p[i];
usebit[j]=1;
ava=1;
break;
}
}
}
// fifo
if(ava==0)
{
for(j=0;j<3;j++)
usebit[j]=0;
}
f[0]=p[i];
usebit[0]=1;
}
printf("The number of Hits: %d",hit);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote