Professional Documents
Culture Documents
Osy Report
Osy Report
Micro-Project Report
On
Submitted By:-
Name of Student Enrollment No.
Mr. J M Meshram
Head of Department
Department of Computer Engineering
1
Certificate
This is to certify that the Micro Project titled
Submitted By:-
MR. J M MESHARAM
HEAD OF DEPARTMENT
DEPARTMENT OF COMPUTER
ENGINEERING
1 Rationale 4
2 Aim/Benefit of the micro-project 5
3 Course Outcomes Addressed 5
4 Literature Review 6-25
5 Actual Methodology Followed 26-25
6 Actual Resources Used 26-31
7 Outputs of the Micro-Project 32
8 Skill Developed / learning out of this Micro-Project 33
9 Applications of this Micro-Project 33
3
Micro-Project Report
1.0 Rationale
Page replacement algorithms are an important part of virtual memory management and it helps
the OS to decide which memory page can be moved out, making space for the currently needed
page. However, the ultimate objective of all page replacement algorithms is to reduce the number
of page faults.
From this micro-project we can understand the working program of page replacement
algorithm.
4
4.0 Literature Review
The page replacement algorithm decides which memory page is to be replaced. The process of
replacement is sometimes called swap out or write to disk. Page replacement is done when the
requested page is not found in the main memory (page fault).
There are two main aspects of virtual memory, Frame allocation and Page Replacement. It is very important
to have the optimal frame allocation and page replacement algorithm. Frame allocation is all about how
many frames are to be allocated to the process while the page replacement is all about determining the page
number which needs to be replaced in order to make space for the requested page.
However, if OS allocates more frames to the process then there can be internal fragmentation.
2. If the page replacement algorithm is not optimal then there will also be the problem of thrashing. If the
number of pages that are replaced by the requested pages will be referred in the near future then there will
be more number of swap-in and swap-out and therefore the OS has to perform more replacements then
usual which causes performance deficiency.
Therefore, the task of an optimal page replacement algorithm is to choose the page which can limit the
thrashing.
Optimal Page Replacement algorithm → this algorithms replaces the page which will not be referred for so long
in future. Although it can not be practically implementable but it can be used as a benchmark. Other algorithms are
compared to this in terms of optimality.
5
Least recent used (LRU) page replacement algorithm → this algorithm replaces the page which has not been
referred for a long time. This algorithm is just opposite to the optimal page replacement algorithm. In this, we look at
the past instead of staring at future.
FIFO → in this algorithm, a queue is maintained. The page which is assigned the frame first will be replaced first. In
other words, the page which resides at the rare end of the queue will be replaced on the every page fault.
6
Program FIFO:
#include <stdio.h>
int main()
{
int referenceString[10], pageFaults = 0, m, n, s, pages, frames;
printf("\nEnter the number of Pages:\t");
scanf("%d", &pages);
printf("\nEnter reference string values:\n");
int(m = 0; m < pages; m++)
{
printf("Value No. [%d]:\t", m + 1);
scanf("%d", &referenceString[m]);
}
printf("\n What are the total number of frames:\t");
{
scanf("%d", &frames);
}
inttemp[frames];
for(m = 0; m < frames; m++)
{
temp[m] = -1;
}
for(m = 0; m < pages; m++)
{
s = 0;
for(n = 0; n < frames; n++)
{
if(referenceString[m] == temp[n])
{
s++;
pageFaults--;
}
}
pageFaults++;
if((pageFaults <= frames) && (s == 0))
{
temp[m] = referenceString[m];
}
else if(s == 0)
{
temp[(pageFaults - 1) % frames] = referenceString[m];
}
printf("\n");
for(n = 0; n < frames; n++)
{
printf("%d\t", temp[n]);
}
}
printf("\nTotal Page Faults:\t%d\n", pageFaults);
return 0;
}
7
Program LRU:
#include<stdio.h>
int findLRU(int time[], int n){
int i, minimum = time[0], pos = 0;
for(i = 1; i < n; ++i){
if(time[i] < minimum){
minimum = time[i];
pos = i;
}
}
return pos;
}
int main()
{
int no_of_frames, no_of_pages, frames[10], pages[30], counter = 0, time[10], flag1, flag2,
i, j, pos, faults = 0;
printf("Enter number of frames: ");
scanf("%d", &no_of_frames);
printf("Enter number of pages: ");
scanf("%d", &no_of_pages);
printf("Enter reference string: ");
for(i = 0; i < no_of_pages; ++i){
scanf("%d", &pages[i]);
}
for(i = 0; i < no_of_frames; ++i){
frames[i] = -1;
}
for(i = 0; i < no_of_pages; ++i){
flag1 = flag2 = 0;
for(j = 0; j < no_of_frames; ++j){
if(frames[j] == pages[i]){
counter++;
time[j] = counter;
flag1 = flag2 = 1;
break;
}
}
8
if(flag1 == 0){
for(j = 0; j < no_of_frames; ++j){
if(frames[j] == -1){
counter++;
faults++;
frames[j] = pages[i];
time[j] = counter;
flag2 = 1;
break;
}
}
}
if(flag2 == 0){
pos = findLRU(time, no_of_frames);
counter++;
faults++;
frames[pos] = pages[i];
time[pos] = counter;
}
printf("\n");
for(j = 0; j < no_of_frames; ++j){
printf("%d\t", frames[j]);
}
}
printf("\n\nTotal Page Faults = %d", faults);
return 0;
}
9
COMPUTER SYSTEM :
We have used DELL INSPIRON , 8th generation WITH INBUILT WINDOWS 10
Operating system of 3.20 GHz INTEL Pentium Core processor with i7technology
computer ( PC ).
Dell Inspiron desktops and all-in-one PCs are designed with innovative
technology and latest features .
Reference Websites:
https://www.tecmint.com/top-most-popular-linux-distributions/
https://fossbytes.com/best-linux-desktop-environments/
https://en.wikipedia.org/wiki/Linux
https://whatis.techtarget.com/reference/Linux-distributions-with-GUI-install
10
5.0 Actual Methodology Followed
1. First we have collected required Information From Internet and From Websites.
2. After collecting the requirements we have Distributed the work tasks to our Team
Members.
1. After analyzing the page replacement algorithm we have Started Preparing the report
of page replacement algorithm and making program.
11
6.0 Actual Resources Used
S. Name of Specifications Qty. Remarks
No. Resource/material
1 Computer system Desktop or Laptop with approx. 1 Collecting
2GB RAM, 500GB HDD or Informations from
SSD with at least Intel core-i3 internet.
processor.
2 Operating system Linux OS (Ubuntu 20.0.14) 1 For Preparing
software tools Report after
analyzing OS
3 Office Software Microsoft Word 2013 or others - Preparing
Packages Demonstration
Report.
12
7.0 Outputs of the Micro-Project
FIFO
LRU
13
8.0 Skill Developed / learning out of this Micro-Project
Skills Developed From this micro-project is that we have the working of
page replacement algorithm.
**************
14