crack001

LRU Page Replacement Algorithm in C Language with Output

Posted by crack001 | Posted in Operating System, Uncategorized | Posted on 07-12-2013

lru page replacement algorithm in ctoday we implement least Recently used LRU page replacement algorithm in c. with this LRU page replacement algorithm in OS used for managing processes waiting time. this algorithm is use least recently used processes for the replacement of the page fault in Operating System.

In this section we can discuss lru page replacement algorithm with example . the Least Recently used Scheduling algorithm may be beneficial. replacement the pages with recently used if they are not longer available for processing.

LRU page replacement algorithm in c Example

In this lru page replacement algorithm example only 3 page slot available. the process are given bellows.

5  6   9   5   4  3   9  9   3  5

5 5 5 5 5 5 5 5
NULL 6 6 6 4 4 9 9
NULL NULL 9 9 9 3 3 3

In this above table the pages fault can be replaced only when it will least recently used. if two or more are have same occurrence then FCFC scheduling algorithm is used.

download PDF :

 

lru Page Replacement Algorithm in c

 

lru page replacement algorithm in c

 

Watch this video to Now more about this page replacement algorithm. Make your concept clear and step by step with example now start watching this video.

 

 LRU page replacement algorithm in c Language with Output

#include<stdio.h>

#include<conio.h>

#define high 25void main()

{

int fframe[10],used[10],index;

int count,n1,k,nf,np=0,page[high],tmp;

int flag=0,pf=0;

clrscr();

printf(“Enter no. of frames:”);

scanf(“%d”,&nf);

for(i=0;count<nf;count++)

fframe[count]=-1;

printf(” lru page replacement algorithm in c “);

printf(“Enter pages (press -999 to exit):\n”);

for(count=0;count<high;count++)

{

scanf(“%d”,&tmp);

if(tmp==-999) break;

page[count]=tmp;

np++;

}

for(count=0;count<np;count++)

{

flag=0;

for(n1=0;n1<nf;n1++)

{

if(fframe[n1]==page[count])

{

printf(“\n\t”);

flag=1;break;

}

}

if(flag==0)

{

for(n1=0;n1<nf;n1++) used[n1]=0;

for(n1=0,tmp=count-1;n1<nf-1;n1++,tmp–)

{

for(k=0;k<nf;k++)

{

if(fframe[k]==page[tmp])

used[k]=1;

}

}

for(n1=0;n1<nf;n1++)

if(used[n1]==0)

index=n1;

fframe[index]=page[count];

printf(“\nFault:  “);

pf++;

}

for(k=0;k<nf;k++)

printf(“%d\t”,fframe[k]);

}

printf(“\nnumber of total page faults is: %d “,pf);

getch();

}

 

 

Output of LRU page replacement algorithm in c

 

lru page replacement algorithm in c

Enter no. of framesEnter pages (press -999 to exit):

2   3    2   1

5   2    4   5

3   2   5  -999

-1  -1   2   Fault:

-1  -1   2   Fault:

-1   3    2   Fault:

1    3     2   Fault:

1    3    2

1    5   2   Fault:

4    5    2   Fault:

4   5   2

4    5   3   Fault:

2   5   3   Fault:

2   5   3

2  5    3

thank you for reading LRU page replacement algorithm in c with example.

 

FiFo Page Replacement Algorithm in C program OS

Posted by crack001 | Posted in Operating System, Uncategorized | Posted on 07-12-2013

Today’s discuss is based on FIFO page replacement algorithm in Operating System and FIFO page replacement algorithm in c program and example. This is the simplest algorithm for solving the problem of page replacement in Operating System. The Implementation of this kind of algorithm is easy and fast. In this Page replacement algorithm First come will be replaced with new coming process. FIFO Page Replacement algorithm in Operating System is time consuming and not much optimal in case of many process.

fifo page replacement algorithm in c program code operating system

Today we discuss on following topics:

  • fifo page replacement algorithm in operating system.
  • fifo page replacement algorithm code.
  • fifo page replacement algorithm program.
  • fifo page replacement algorithm example.
  • fifo page replacement algorithm in c program.

fifo page replacement algorithm example

in this example we have ( 5, 2,  1,  8,  3  ) are five process which are placed in page table by operating system  in FIFO Manner. this queue has 3 slot for replacement of page fault.

5 5 5 8 8
2 2 4 3
1 1 1

the new coming process is replaced with oldest process in the page table.

fifo page replacement algorithm in c program

#include<stdio.h>
int main()
{
int i,j,n,a[50],frame_page[6],no,k,page-avl,cont=0;
printf(“\n fifo page replacement algorithm in c \n”)
printf(“\n enter Total page in Queue:\n”);
scanf(“%d”,&n);
printf(“\n ENTER THE PAGE NUMBER :\n”);
for(i=1;i<=n;i++)
scanf(“%d”,&a[i]);
printf(“\n TOTAL frame_pageS ARE :”);
scanf(“%d”,&no);
for(i=0;i<no;i++)
frame_page[i]= -1;
j=0;
printf(“\tref string\t page frame_pages\n”);
for(i=1;i<=n;i++)
{
printf(“%d\t\t”,a[i]);
page-avl=0;
for(k=0;k<no;k++)
if(frame_page[k]==a[i])
page-avl=1;
if (page-avl==0)
{
frame_page[j]=a[i];
j=(j+1)%no;
cont++;
for(k=0;k<no;k++)
printf(“%d\t”,frame_page[k]);
}
printf(“\n”);
}
printf(“Page Fault Is %d”,cont);
return 0;
}

Ouput of fifo page replacement algorithm in c

fifo page replacement algorithm in c
ENTER THE NUMBER OF PAGES:  10
enter number of pages are page-avlable :       8 0 1 6 0 3 0 9 6 3 0 3 6 1 6 0 1 8 0 1
TOTAL frame_pageS ARE :3
ref string       page frame_pages
8               8       -1      -1
0               8       0       -1
1               8       0       1
6               6       0       1
0
3               6       3       1
0               6       3       0
9               9       3       0
6               9       6       0
3               9       6       3
0               0       6       3
3
6
1               0       1       3
6               0       1       6
0
1
8               8       1       6
0               8       0       6
1               8       0       1
Page Fault Is 15

so today we have discussed on the topic which are beneficial page replacement of page table value to make CPU utilization faster and increase processor performance.

Round Robin Scheduling Algorithm in operating system

Posted by TheCrack001 | Posted in Operating System | Posted on 07-12-2013

asdlfja klsdjfklasjdfkl jaksldfj kalsdjfklajksdlfjk

Round Robin Scheduling Program in C programming in OS

Posted by TheCrack001 | Posted in Operating System | Posted on 07-12-2013

aksdlfjaksd kajsdkflj aksdjfklajskd ljkajfksdfasdf a asdf

Implement FCFS Program in C Language

Posted by TheCrack001 | Posted in Operating System | Posted on 07-12-2013

ajsd;fkla;sdjnas m,d m,zxcmsd;jam,

First Come First Serve Scheduling Algorithm Steps with example

Posted by TheCrack001 | Posted in Operating System | Posted on 07-12-2013

link is diverted

please wait

http://www.project-download.com/programs/os/first-come-first-serve-scheduling-algorithm-example/

Shortest Job First Scheduling Algorithm | pseudocode

Posted by TheCrack001 | Posted in Operating System | Posted on 29-11-2013

SJF Scheduling Program in C Language

Posted by TheCrack001 | Posted in Operating System | Posted on 29-11-2013

information visit

http://www.project-download.com/programs/os/shortest-job-first-sjf-scheduling-program-c/

Top 10 Best C Compiler IDEs

Posted by crack001 | Posted in Programming | Posted on 12-08-2013

C Compiler IDEsc compiler ides are powerful programming languages and every new programmer should have to aware of them because these two programming languages provides the base for other programming languages. Beside this, These programming language are widely used even by the proficient programmers to interact with hardware. Efficiency of any programmer and programming language is always some how depends on programming environment and c compiler ides being used at the time of programming. know don’t west time download C Compiler IDEs. New programmers always finds difficulty in selection of c compiler ides which provides them an user friendly programming environment.You can select any C Compiler IDEs of your choice which will make your programming job easier.

Here’s The List of Top 10 Best C Compiler IDEs :

c compiler IDEs:

 

  1. Eclipse: c compiler IDEs

    Eclipse Ide is an open source utility that provides some advance functionality for C++ / c compiler IDEs programmers. Including great features like syntax highlighting,debugger and auto code completion. Eclipse ide is supported on Windows,Linux and Mac OS X. Eclipse ide made coding easier for new programmers. You can download eclipse c++ /c compilers IDEs to your computer from following download link.

    Download Link

    You will need Java Run time environment to compile your C Compiler IDEs Programs on your computer. You can download JRE from the following Download Link.

    Download Link

  2. NetBeans:

    NetBeans is another advance open source ide with features like semantic highlighting,automatic formatting braces matching,unit testing,code assistance and many more.

    You can download NetBeans ide from following download link.

    Download Link

  3. Code::Blocks c compiler IDEs:

    Code::blocks is an open source,cross platform and extensible c compilers IDEs .The best feature of thisc compilers IDEs is that,As per on your need, you can extend this ide with the help of plugins available. You can download Code::Blocks from following download link.

    Download Link

  4. Digital Mars:

    Digital mars is another free c/c++ compiler with command line and GUI versions. The feature that keep Digital Mars from other C/C++ compilers is that Digital mars have a fast compile and link time. You can download Digital Mars C Compilers IDEs from following download link.

    Download Link

  5. C Free:

    C a great alternative for traditional turbo c compiler. Its a small c ide with some excellent features. one thing to notice is that C free is not a free ide but you can use this 30 days for free. You can download the trail version this from the following download link.

    Download Link

  6. Sky IDE:

    Sky ide is a multi-compiler,multi-view, multi- project and multi-profile free c++ ide. Sky ide also supports other languages like java,php and JavaScript. Sky ide has powerful text manipulation,Syntax coloring,auto complete,line tracker functions.You can download Sky ide free C Compilers IDEs from following download link.

    Download Link

  7. Dev C++ :

    Dev C++ uses mingw port of Gcc as its compiler. Dev C++ also supports c language and its feature includes Gcc based compiler,syntax highlighting,auto code completion,project manager and print support. You can download Dev C++ ide from following download link.

    Download Link

  8. CodeLite:

    Like Code::Blocks C++ ide, Codelite is also an open source,cross platform ide for C/C++ Programming languages. Codelite can work on various Operating systems including Windows,Linux and Mac os. You can download CodeLite From the following Link.

    Download Link

  9. MinGW:

    MinGw compilers provide a set of programming tools which is suitable for native windows applications. MinGw includes a port of GCC (GNU) including C,C++,ADA and Fortan Compilers. Its an open source compiler and you can download it from following link.

    Download Link

  10. Ultimate++ :

    U++ is a cross platform RAD c compiler ides focused on c++ programmers productivity. It includes a set of libraries including GUI and SQl. U++ works with GCC,Visual C++ and MingGW. You can download This Ide from following download link.

    Download Link

Have any questions in related c compiler ides mind Lets talk in comment section below.