https://github.com/cizr/fifo-algorithm-in-c
Execution/Implementation of FIFO (First in First Out) Algorithm in C
https://github.com/cizr/fifo-algorithm-in-c
algorithm fifo
Last synced: 3 months ago
JSON representation
Execution/Implementation of FIFO (First in First Out) Algorithm in C
- Host: GitHub
- URL: https://github.com/cizr/fifo-algorithm-in-c
- Owner: Cizr
- Created: 2022-03-17T19:30:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-17T21:42:26.000Z (over 3 years ago)
- Last Synced: 2025-01-27T06:43:26.726Z (5 months ago)
- Topics: algorithm, fifo
- Language: C
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**To write a c program to implement FIFO page replacement algorithm**
# FIFO :
This is the simplest page replacement algorithm. In this algorithm,**the operating system keeps track of all pages in the memory in a queue, the oldest page is in the front of the queue**. When a page needs to be replaced page in the front of the queue is selected for removal# Inputs required :
1. Input the number of pages. (Value of ref)
2. Input values of page value. (series of references)
3. Input size of frames. (number of frames,in this code its maxed on 10)# Course of action :
When frame array is full and when new value come we need to see if already present in frame array or not,if not the new value and we need to enter that value in array and remove the value using FIFO concept. Page Fault counter will increment here.# Output :
1. Number of pages
2. Value of pages
3. The frames
4. Number of page faults# Example :
1. In my example we have
2. Enter the no. of pages :12
3. Enter the page numbers :0, 0, 1, 0, 3, 1, 2, 2, 4, 4, 3, 0
4. Enter the number of frames: 2
5. ref string page frames
. 0 0 -1
. 0
. 1 0 1
. 0
. 3 3 1
. 1
. 2 3 2
. 2
. 4 4 2
. 4
. 3 4 3
. 0 0 3
6. Total Page Fault is 7