Optimal page replacement algo cant be implemented in the real life as in this algo we need to find the knowledge of the feature and that is not possible
#include void main() { int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0; printf("Enter the length of the reference string --"); scanf("%d",&n); printf("Enter the reference string -- "); for(i=0;i
Code : #include void main() { int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0; printf("Enter the length of the reference string --"); scanf("%d",&n); printf("Enter the reference string -- "); for(i=0;i
Run this code the same as in the video #include void main() { int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0; printf("Enter the length of the reference string --"); scanf("%d",&n); printf("Enter the reference string -- "); for(i=0;i
#include void main() { int i, j, f, pf = 0, rs[25], frame[10], n, age[10]; printf(" Enter the length of reference string -- "); scanf("%d", &n); printf(" Enter the reference string -- "); for (i = 0; i < n; i++) { scanf("%d", &rs[i]); } printf(" Enter no. of frames -- "); scanf("%d", &f); for (i = 0; i < f; i++) { frame[i] = -1; age[i] = 0; } printf(" The Page Replacement Process is -- "); for (i = 0; i < n; i++) { printf("%d\t", rs[i]); int found = 0; for (j = 0; j < f; j++) { if (frame[j] == rs[i]) { age[j] = 0; found = 1; // no page fault break; } } // Inside the loop where you check for page fault if (!found) // page fault { int flag = 0; // Initialize to -1, indicating no empty frame found for (j = 0; j < f; j++) { if (frame[j] == -1) { // printf(" Empty frame"); frame[j] = rs[i]; age[j] = 0; flag = 1; break; // Found an empty frame, exit the loop } } if (flag == 0) { // If no empty frame is available, perform LRU replacement as before int max_age = age[0]; int max_age_index = 0; for (j = 1; j < f; j++) { if (age[j] > max_age) { max_age = age[j]; max_age_index = j; } } frame[max_age_index] = rs[i]; age[max_age_index] = 0; } pf++; // Increment page fault count } // If there was a page fault, print the page fault number for (j = 0; j < f; j++) { printf("\t%d", frame[j]); age[j]++; } if (!found) { printf("\t\t\tPF No. %d", pf); } printf(" "); } printf(" The number of Page Faults using LRU are %d", pf); }
U are only reading out the sentence, not even a single logic
Ith program explain cheyunilalo
not explained properly
Can you provide the code for Least recently used page replacement algorithm
LFU aarelumm aykuvooo
LFU(Least Frequently Used) koode explain cheyyamo
Hi
Mam code ayako urgent mam 🥺
can you share code for optimal page replacement to ?
Optimal page replacement algo cant be implemented in the real life as in this algo we need to find the knowledge of the feature and that is not possible
@@funnyanimation888 knowledge of the *future
Miss operating system notes alla modules share cheyyamo.
could you send code for optimal algorithm
can you provide the codes of the every programs
#include
void main()
{
int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0;
printf("Enter the length of the reference string --");
scanf("%d",&n);
printf("Enter the reference string -- ");
for(i=0;i
Code :
#include
void main()
{
int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0;
printf("Enter the length of the reference string --");
scanf("%d",&n);
printf("Enter the reference string -- ");
for(i=0;i
thanks :)
@@aparnats2598 ok noted ✅️
@@v3g3ta7then its better for u to drop out the course
Have Lfu s code like this?
Mam next
Mam next initially declare
maam next inte value ntha initialize cheythe?
initialize next=0
Very poor explanation
Code link edamo
It is not executing. Waste of time.
It's executing
Run this code the same as in the video
#include
void main()
{
int i,j,k,min,rs[25],m[10],count[10],flag[25],n,f,pf=0,next=0;
printf("Enter the length of the reference string --");
scanf("%d",&n);
printf("Enter the reference string -- ");
for(i=0;i
@@swagtech4895do you have code for LFU
Kitiyo@@ajmaljalal5430
#include
void main()
{
int i, j, f, pf = 0, rs[25], frame[10], n, age[10];
printf("
Enter the length of reference string -- ");
scanf("%d", &n);
printf("
Enter the reference string -- ");
for (i = 0; i < n; i++)
{
scanf("%d", &rs[i]);
}
printf("
Enter no. of frames -- ");
scanf("%d", &f);
for (i = 0; i < f; i++)
{
frame[i] = -1;
age[i] = 0;
}
printf("
The Page Replacement Process is --
");
for (i = 0; i < n; i++)
{
printf("%d\t", rs[i]);
int found = 0;
for (j = 0; j < f; j++)
{
if (frame[j] == rs[i])
{
age[j] = 0;
found = 1; // no page fault
break;
}
}
// Inside the loop where you check for page fault
if (!found) // page fault
{
int flag = 0; // Initialize to -1, indicating no empty frame found
for (j = 0; j < f; j++)
{
if (frame[j] == -1)
{
// printf("
Empty frame");
frame[j] = rs[i];
age[j] = 0;
flag = 1;
break; // Found an empty frame, exit the loop
}
}
if (flag == 0)
{
// If no empty frame is available, perform LRU replacement as before
int max_age = age[0];
int max_age_index = 0;
for (j = 1; j < f; j++)
{
if (age[j] > max_age)
{
max_age = age[j];
max_age_index = j;
}
}
frame[max_age_index] = rs[i];
age[max_age_index] = 0;
}
pf++; // Increment page fault count
}
// If there was a page fault, print the page fault number
for (j = 0; j < f; j++)
{
printf("\t%d", frame[j]);
age[j]++;
}
if (!found)
{
printf("\t\t\tPF No. %d", pf);
}
printf("
");
}
printf("
The number of Page Faults using LRU are %d", pf);
}