Skip to content

This C++-based program implements several of the most popular page replacement algorithms (Optimal, FIFO, LRU, Clock).

License

Notifications You must be signed in to change notification settings

MohEsmail143/page-replacement-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Page Replacement Algorithms

This C++-based program implements several of the most popular page replacement algorithms (Optimal, FIFO, LRU, Clock). Your input will be from standard input. Your output will be to standard output. The input will contain the number of pages allocated to the process, the simulated algorithm (OPTIMAL, FIFO, LRU, or CLOCK), and then a sequence of page references like below:

3
FIFO
5
12
5
2
4
2
5
......
-1

Note: The last line in the input is -1 (and is ignored). For each run, the following is printed:

  1. A trace recording page faults for each memory reference in the sequence.
  2. Counter recording total page faults.

We will have the following results (notice the two-digit page numbers):

Replacement Policy = FIFO
-------------------------------------
Page Content of Frames
--- -----------------
05 05
12 05 12
05 05 12
02 05 12 02
04 F 04 12 02
02 04 12 02
05 F 04 05 02
-------------------------------------
Number of page faults = 2

This project was developed as part of the course Operating Systems in the Fall 2021 semester at the Faculty of Engineering, Alexandria University, under the Computer and Communications Engineering department, supervised by Dr. Hicham Elmongui.

Prerequisites

This project was developed using the Ubuntu operating system.

Installing

1- Clone the repository to your local machine:

git clone https://github.com/MohEsmail143/page-replacement-algorithms.git

2- Extract the tests.zip file to get a list of tests to try out.

3- Compile and run the program.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

This C++-based program implements several of the most popular page replacement algorithms (Optimal, FIFO, LRU, Clock).

Topics

Resources

License

Stars

Watchers

Forks