Professional Documents
Culture Documents
Fifo Code
Fifo Code
h>
#define MAX_FRAMES 3
int main() {
scanf("%d", &numPages);
scanf("%d", &pageReferences[i]);
}
// Initialize frames to -1, indicating they are initially empty
frames[i] = -1;
int pageFound = 0;
if (frames[j] == currentPage)
pageFound = 1;
break;
}
if (pageFound == 0) {
pageFaults++;
// Replace the oldest page in the frame with the current page
frames[framePointer] = currentPage;
printf("Frames: ");
if (frames[j] == -1) {
printf("- ");
} else {
}
}
printf("\n");
return 0;