selle05 0 Newbie Poster

can someone help me in creating a program that will simulate the two page replacement algorithms by using a reference pattern or string. The output of the program is to give the number of page faults of the two algorithms.

Details of the program:

1. Declare a one dimensional integer array that will serve as storage of the reference pattern. Assume a 20-element integer array to represent a maximum of 20 page references. Declare an integer variable called NumberOfReferences to represent the actual number of page references.

2. Let the user enter a number from 1 to 20 indicating the number of page references he or she wants to be simulated. Should the user enter an invalid number (less than 1 or more than 20), simply display a message saying "INVALID NUMBER ENTERED" and let the user reenter a number again. This number should be stored to bariable NumberofReferences.

3. Once a valid number is entered, the next step is to ask the user to enter each element of the reference pattern.

Example:
Enter the first element of the page reference pattern: 1
Enter the second element of the page reference patteren: 2
Enter the third element of the page reference pattern: 3
Enter the third element of the page reference pattern: 4
Enter the third element of the page reference pattern: 3
(and so on)

4. Once the user enters the last element of the page reference pattern (as indicated by the contents of the NumberOfReferences), the program should start the simulation and output the total number of page faults produced by the each algorithm.

The total number of page faults using the FIFO algorithm is 9.
The total number of page faults using the LRU algorithm is 8.


Please help me!... Thank You! =)