Search This Blog

Friday, November 25, 2011

PRIORITY SCHEDULING ALGORITHM IN C

#include<stdio.h>
#include<conio.h>

int main()
 {
    int temp,temp1,n,pp[10],bt[10],waiting[10],awt=0,i,twt=0,j;
   printf("Enter the number of process : ");
   scanf("%d",&n);
 
   for(i=0;i<n;i++)
    {
      printf("\n Enter process burst time");

      scanf("%d",&bt[i]);
            printf(" : time priorities \n");
            scanf("%d",&pp[i]);
   
    }
  for(i=0;i<n-1;i++)
   {
     for(j=i+1;j<n;j++)
     {
       if(pp[i]>pp[j])
       {
         temp=pp[i];
         pp[i]=pp[j];
         pp[j]=temp;
         temp1=bt[i];
         bt[i]=bt[j];
         bt[j]=temp1;
   
      }
   }
}
waiting[0]=0;
 for(i=1;i<n;i++)
                    {
                                     waiting[i]=waiting[i-1]+bt[i-1];
                                     twt=twt+waiting[i];
                                     }
                                   
                                                          printf("\ntotal waiting time=%d",twt);
                                    
                                                      awt=twt/n;
                                     printf("\nAverage waiting time=%d",awt);

getch();
}

SJF SCHEDULING ALGORITHM IN C

#include<stdio.h>
#include<conio.h>
#include<process.h>
int main()
{
char temp[5];
int tot=0,wt[10],bt[10],i,j,n,temp1;
int avg=0;

printf("enter no of processes:");
scanf("%d",&n);
printf("enter burst time");
for(i=0;i<n;i++)
{
scanf("%d",&bt[i]);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(bt[i]>bt[j])
{
temp1=bt[i];
bt[i]=bt[j];
bt[j]=temp1;

}
}
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=wt[i-1]+bt[i-1];
tot=tot+wt[i];
}
avg=tot/n;
printf("total waiting time=%d\n avg waiting time=%d",tot,avg);
getch();
}

FCFS SCHEDULING ALGORITHM IN C

#include<stdio.h>
#include<conio.h>
#include<process.h>
int main()
{
    int n,i,burst[100],awt=0,twt=0,waiting[100];
    printf("Enter number of processes");
    scanf("%d",&n);
    printf("Enter burst time");
    for(i=0;i<n;i++)
    {
                    scanf("%d",&burst[i]);
                    }
                    waiting[0]=0;
                    for(i=1;i<n;i++)
                    {
                                     waiting[i]=waiting[i-1]+burst[i-1];
                                     twt=twt+waiting[i];
                                     }
                                    
                                                          printf("\ntotal waiting time=%d",twt);
                                     
                                                      awt=twt/n;
                                     printf("\nAverage waiting time=%d",awt);
                                     getch();
                                     }
                                                     

Friday, April 8, 2011

TRICK TO ACTIVATE THE HIDDEN ADMINISTRATOR ACCOUNT IN WINDOWS

USE COMMAND-->(to activate)

net user administrator /active:yes 

 USE COMMAND-->(to deactivate)

 net user administrator /active:no


ENJOY!!!!!




Wednesday, April 6, 2011

QUOTE OF THE DAY...

If you give a hacker a new toy, the first thing he'll do is take it apart to figure out how it works.......

Tuesday, April 5, 2011

QUOTE OF THE DAY

I think Linux is a great thing, in the big picture. It's a great hacker's tool, and it has a lot of potential to become something more......

MAKING DRIVE VISIBLE

As we have seen in the last how to hide the drive.....now we will discuss how to make it again visible?

First Step:

Open command prompt by opening it from start in windows.....after this write diskpart.

Second Step:

After this write list volume....a list of drives available in your computer will appear on the screen...


Third Step:


Now select the drive which you want to make visible...by writing select volume (drive number)...
eg: select volume 4


Fourth Step:

Write... assign letter (drive name).
eg: assign letter E



Fifth Step:


After this your drive is visible again.