$24
OBJECTIVE:
PROGRAM 1: Write a C program to implement paging using Best-fit algorithm
PROGRAM 2: Write a C program to implement Least Recently Used page replacement (LRU) algorithm.
PROGRAM 1: Write a C Program to implement paging using Best-fit algorithm
Sample Output:
Your output can slightly vary depending upon your implementation and the manner in which you are taking input values.
PROGRAM 2: Write a C Program to implement LRU algorithm
Define a reference string and number of frames for the input to your program as shown below and determine the total number of page faults
Your output can slightly vary depending upon your implementation and the manner in which you take input values
INPUT
Enter the length of reference string -- 20
Enter the reference string -- 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
Enter the number of frames -- 3
OUTPUT
The Page Replacement process is –
7 -1 -1 PF No. -- 1
7 0 -1 PF No. -- 2
7 0 1 PF No. -- 3
2 0 1 PF No. -- 4
2 0 1
2 0 3 PF No. -- 5
2 0 3
4 0 3 PF No. -- 6
4 0 2 PF No. -- 7
4 3 2 PF No. -- 8
0 3 2 PF No. -- 9
0 3 2
0 3 2
1 3 2 PF No. -- 10
1 3 2
1 0 2 PF No. -- 11
1 0 2
1 0 7 PF No. -- 12
1 0 7
1 0 7
The number of page faults using LRU is 12