Thursday 7 April 2016

SJF CPU Scheduling Algorithm (Preemptive)

//PROGRAM FOR SHORTEST-JOB-FIRST(SJF) "CPU SCHEDULING ALGORITHM" WITH PRE_EMPTION
 #include<stdio.h>  
 #include<conio.h>  
 int main()  
 {  
   int n,at[10], bt[10], ct[10], wt[10], tn =0, c, ta[10],tat[10];  
   //at-ArritvalTime::br-BurstTime::ct-CompletionTime::ta-TemporaryArray  
   //wt-WaitingTime::tat-TurnAroundTime::tn-CurrentTime(TimeNow)  
  // int i, j, k, tot, pc=0, pointer = 0, lp=-1;//lp-Last-executedProcess  
   int i, k, tot, pc=0, pointer = 0, lp=-1;//lp-Last-executedProcess  
   char pn[10][10];  
   printf("Enter the number of processes: ");  
   scanf("%d",&n);  
   printf("Enter <ProcessName> <ArrivalTime> <BurstTime>\n");  
   for(i=0;i<n;i++)  
     scanf("%s%d%d",&pn[i],&at[i],&bt[i]);  
   for(i=0; i<n; i++)  
   {  
       ct[i] = -1;  
       ta[i] = bt[i];  
   }  
   while(pc!=n)  
   {  
     k=0;  
     c = 0;  
     for(i=0; i<n; i++)  
     {  
       if(ct[i]<0 && at[i]<=tn)  
         c++;  
     }  
     if(c==0)  
       tn++;  
     else  
     {  
       pointer = 0;  
       while(at[pointer]>tn || ct[pointer]>0)  
         pointer++;  
       for(k=pointer+1; k<n; k++)  
         if( (at[k]<=tn && ct[k]<0) &&  
           ( (bt[pointer]==bt[k] && k==lp) || bt[pointer]>bt[k] ) )  
             pointer = k;  
       if(ct[pointer]<0)  
       {  
         bt[pointer]--;  
         tn++;  
         if(bt[pointer]==0)  
         {  
           ct[pointer] = tn;  
           wt[pointer] = ct[pointer] - ( at[pointer]+ ta[pointer] );  
           tat[pointer] = ct[pointer] - at[pointer];  
           pc++;  
         }  
       }  
       lp = pointer;  
     }  
   }  
   printf("\nPN\tAT\tBT\tCT\tWT\tTAT\n");  
   for(i=0;i<n;i++)  
     printf("%s\t%d\t%d\t%d\t%d\t%d\n",pn[i],at[i],ta[i],ct[i],wt[i],tat[i]);  
   return 0;  
 }  
 /* SAMPLE OUTPUT  
 Enter the number of processes: 6  
 Enter <ProcessName> <ArrivalTime> <BurstTime>  
 p1 3 1  
 p2 1 4  
 p3 10 6  
 p4 25 10  
 p5 1 3  
 p6 12 3  
 PN   AT    BT   CT   WT   TAT  
 p1   3     1     5    1     2  
 p2   1     4     9    4     8  
 p3   10    6    19    3     9  
 p4   25   10    35    0    10  
 p5   1     3    4     0     3  
 p6   12    3    15    0     3  
 */  

SJF CPU Scheduling Algorithm (Non-Preemptive)

 //PROGRAM FOR SHORTEST-JOB-FIRST(SJF) "CPU SCHEDULING ALGORITHM" WITHOUT PRE_EMPTION  
 #include<stdio.h>  
 #include<conio.h>  
 int main()  
 {  
   int at[10], bt[10], ct[10], wt[10], ta[10], tat[10];  
   //at-ArritvalTime::br-BurstTime::ct-CompletionTime::ta-TemporaryArray  
   //wt-WaitingTime::tat-TurnAroundTime::tn-CurrentTime(TimeNow)  
   int n, i, k, pc=0, pointer = 0, tn =0, c;//pc-ProcessesCompleted  
   char pn[10][10]; //pn-ProcessName  
   printf("Enter the number of processes: ");  
   scanf("%d",&n);  
   printf("Enter <ProcessName> <ArrivalTime> <BurstTime>\n");  
   for(i=0;i<n;i++)  
     scanf("%s%d%d",&pn[i],&at[i],&bt[i]);  
   for(i=0; i<n; i++)  
   {  
     ct[i] = -1;  
     ta[i] = bt[i];  
   }  
   while(pc!=n)  
   {  
     c = 0;  
     for(i=0; i<n; i++)  
       if(ct[i]<0 && at[i]<=tn)  
         c++;  
     if(c==0)  
       tn++;  
     else  
     {  
       pointer = 0;  
       while(at[pointer]>tn || ct[pointer]>0)  
         pointer++;  
       for(k=pointer+1; k<n; k++)  
         if(at[k]<=tn && ct[k]<0 && bt[pointer]>bt[k])  
           pointer = k;  
       if(ct[pointer]<0)  
       {  
         tn=tn+bt[pointer];  
         bt[pointer] = 0;  
         ct[pointer] = tn;  
         wt[pointer] = ct[pointer] - ( at[pointer]+ ta[pointer] );  
         tat[pointer] = ct[pointer] - at[pointer];  
         pc++;  
       }  
     }  
   }  
   printf("\nPN\tAT\tBT\tCT\tWT\tTAT\n");  
   for(i=0;i<n;i++)  
     printf("%s\t%d\t%d\t%d\t%d\t%d\n",pn[i],at[i],ta[i],ct[i],wt[i],tat[i]);  
   return 0;  
 }  
 /* EXAMPLE OUTPUT  
 Enter the number of processes: 6  
 Enter <ProcessName> <ArrivalTime> <BurstTime>  
 p1 3 2  
 p2 6 5  
 p3 1 1  
 p4 6 2  
 p5 15 3  
 p6 20 10  
 PN   AT   BT    CT    WT   TAT  
 p1   3     2     5    0     2  
 p2   6     5     13   2     7  
 p3   1     1     2    0     1  
 p4   6     2     8    0     2  
 p5   15    3    18    0     3  
 p6   20   10    30    0    10  
 */   
//ANOTHER PROGRAM for the same problem
 //PROGRAM FOR SHORTEST-JOB-FIRST(SJF) "CPU SCHEDULING ALGORITHM" WITH NO-PRE_EMPTION & ARRIVAL TIMES  
 #include<stdio.h>  
 #include<string.h>  
 int main(void)  
 {  
 //VARIABLE DECLARATION  
   char pn[20][20], c[20][20]; //PN-PROGRAM NAMES C-A TEMPORARY ARRAY  
      int n,i,j,at[20], bt[20], wt[20],ct[20],tat[20]; //bt-BURST TIME ; wt-WAITING TIME; tat-TURN AROUND TIME  
      int temp1, temp2, count=0,twt=0;//,tat=0;  
      printf("Enter number of processes:");  
      scanf("%d", &n);  
      printf("Enter PN, AT, BT:\n");  
 //TAKING INPUT VALUES i.e., PROCESS-NAMES, ARRIVAL-TIMES AND BURST-TIMES  
      for(i=0; i<n; i++)  
           scanf("%s%d%d",&pn[i],&at[i],&bt[i]);  
 //SCHEDULING THE PROCESSES ACCORDING TO SJF  
   for(i=0 ; i<n; i++)  
   {  
           for(j=i+1; j<n; j++)  
       if (  
         //IF THERE IS NO PROCESS IN MAIN MEMORY,  
           //SORT PROCESSES ACCORDING TO ARRIVAL TIMES &  
           //IF WE GOT PROCESSES WITH SAME ARRIVAL TIME SORT THEM BY BURST TIMES  
                     ( (i==0||count<1)&&(at[i]>at[j]||(at[i]==at[j]&&bt[i]>bt[j])) )  
         //IF WE GOT ONLY ONE PROCESS IN MAIN MEMORY AFTER COMPLETION OF THE CURRENT PROCESS  
                ||      (count == 1 && ct[i-1]>=at[j])  
         //IF WE GOT MORE THAN ONE PROCESS IN MAIN MEMORY, SORT THEM BY BURST TIMES  
                ||      ((ct[i-1]>=at[j]&&bt[i]>bt[j]))// || (ct[i-1]<at[i]&&ct[i-1]>=at[j]))  
                  )  
                     //SWAPPING PROCESSES  
                     {  
           temp1 = bt[i];  
           temp2 = at[i];  
           bt[i] = bt[j];  
           at[i] = at[j];  
           bt[j] = temp1;  
           at[j] = temp2;  
           strcpy(c[i],pn[i]);  
           strcpy(pn[i],pn[j]);  
           strcpy(pn[j],c[i]);  
         }  
     if(i==0 || count<1)  
       ct[i] = at[i] + bt[i];  
     else  
       ct[i] = ct[i-1] + bt[i];  
     wt[i] = ct[i] - (at[i] + bt[i]);  
     tat[i] = ct[i] - at[i];  
     count = 0 ;  
     for(j=i+1; j<n; j++)  
       if(ct[i]>=at[j])  
         count++;  
   }  
 //PRINTING THE VALUES AFTER ALL PREOCESSES COMPLETED  
      printf("S.N.\tProcess-Name\tArrival-Time\tBurst-Time\tCT\tWT\tTAT\n");  
      for(i=0; i<n; i++)  
           printf("%d\t\t%s\t\t%d\t\t%d\t%d\t%d\t%d\n",(i+1),pn[i],at[i],bt[i],ct[i],wt[i],tat[i]);  
 } //END OF MAIN  
 /* EXAMPLE OUTPUT  
 Enter number of processes:6  
 Enter PN, AT, BT:  
 p1 3 2  
 p2 6 5  
 p3 1 1  
 p4 6 2  
 p5 15 3  
 p6 20 10  
 S.N.  Process-Name  Arrival-Time  Burst-Time   CT   WT   TAT  
 1        p3       1        1    2    0    1  
 2        p1       3        2    5    0    2  
 3        p4       6        2    8    0    2  
 4        p2       6        5    13   2    7  
 5        p5       15       3    18   0    3  
 6        p6       20       10   30   0    10  
 */  

FCFS

FCFS CPU Scheduling Algorithm

 //PROGRAM FOR FIRST-COME-FIRST-SERVE "CPU SCHEDULING ALGORITHM"  
 #include<stdio.h>  
 #include<string.h>  
 int main(void)  
 {  
   //VARIABLE DECLARATION  
   char pn[20][20], c[20][20]; //PN-PROGRAM NAMES  
   int n,i,j,at[20], bt[20], wt[20],tat[20], ct[20]; //bt-BURST TIME ; wt-WAITING TIME; tat-TURN AROUND TIME  
   int twt=0, ttat=0, temp1, temp2;  
   printf("Enter number of processes:");  
   scanf("%d", &n);  
 //TAKING INPUT VALUES i.e., PROCESS-NAMES, ARRIVAL-TIMES AND BURST-TIMES  
 printf("Enter <Process-name> <Arrival-time> <Burst-time> for processes:\n", (i+1));  
   for(i=0; i<n; i++)  
       scanf("%s%d%d",&pn[i],&at[i],&bt[i]);  
 //SORT THE PROCESSES ACCORDING TO ARRIVAL TIMES  
  for(i=0;i<n;i++)  
  {  
      for(j=i+1; j<n;j++)  
      {  
           if(at[i]>at[j])  
           {  
                temp1 = bt[i];  
                temp2 = at[i];  
                bt[i] = bt[j];  
                at[i] = at[j];  
                bt[j] = temp1;  
                at[j] = temp2;  
                strcpy(c[i],pn[i]);  
                strcpy(pn[i],pn[j]);  
                strcpy(pn[j],c[i]);  
           }  
      }  
      if(i==0) ct[0]=at[0]+bt[0];  
      if(i>0)  
      {  
     if(at[i]>ct[i-1])  
                ct[i]=at[i]+bt[i];  
           else  
                ct[i]=ct[i-1]+bt[i];  
      }  
  }  
 //CALCULATING WAITING TIME & TAT  
 wt[0]=0;  
 tat[0]=ct[0]-at[0];  
 for(i=1;i<n;i++)  
 {  
      tat[i] = ct[i]-at[i];  
      wt[i] = tat[i]-bt[i];  
      twt += wt[i];  
      ttat += tat[i];  
 }  
 //PRINTING THE VALUES AFTER ALL PREOCESSES COMPLETED  
      printf("S.N.\tPN\tAT\tBT\tCT\tWT\tTAT\n");  
      for(i=0; i<n; i++)  
           printf("%d\t%s\t%d\t%d\t%d\t%d\t%d\n",(i+1),pn[i],at[i],bt[i],ct[i],wt[i],tat[i]);  
      printf("Total waiting time:%d\n", twt);  
      printf("Total Turn Around Time:%d", ttat);  
 }  

Friday 1 April 2016

CCNA


Cisco’s Networking Academy offers you the skills and knowledge required for home and small business networking. After completing this course you will have the opportunity to sit for the newly revised CCNA-ENT (Cisco Certified Network Associate, Entry-level Network Technician) industry exam.

You are asking for the CCNA Course syllabus. Here I am uploading a file that contains the CCNA Course syllabus. This is as follows:

Class Expectations
Enter Prepared
Use Technology Responsibly
Behave Maturely
Lab Policies
Leave Things As You Found Them (or Better)
Maintain Privacy, Security, and Independence
Leave Food and Drink Outside

You can download CCNA Course syllabus from here. This is as follows:

CCNA Course syllabus





CCNA Course E-book
in a pdf atteched for more detail..............
Attached Files
File Type: pdf CCNA Course E-book.pdf (1.47 MB, 1544 views)
File Type: pdf CCNA Course syllabus.pdf (54.8 KB, 847 views)

Cisco

Video Lecture Description Sub-Category Time Click to view video
Click to view next page     Page: 1

Back to Computer-Science Video Lecture Course Page
How to configure networking for Windows XP and Vista Cisco CCNA 7 min Click to view videos
Basics of ipconfig, ping, tracert, nslookup, and netstat Cisco CCNA 10 min Click to view videos
Network Layers - OSI, TCP/IP Models -Part 1 Cisco CCNA 9 min Click to view videos
Network Layers - OSI, TCP/IP Models -Part2 Cisco CCNA 8 min Click to view videos
Network Layers - OSI, TCP/IP Models -Part3 Cisco CCNA 4 min Click to view videos
Using nslookup to resolve domain names to ip addresses Cisco CCNA 5 min Click to view videos
Intro to using Wireshark - CCNA Network Fundamentals Cisco CCNA 6 min Click to view videos
Telnet client and server demonstration in Windows Vista and XP Cisco CCNA 9 min Click to view videos
The DHCP process in Wireshark Cisco CCNA 7 min Click to view videos
Packet Tracer for Beginners - Part 1 Cisco CCNA 7 min Click to view videos
Packet Tracer for Beginners - Part 2 Cisco CCNA 9 min Click to view videos
Packet Tracer Intro to Routing - 1, Cisco CCNA Cisco CCNA 11 min Click to view videos
Packet Tracer Intro to Routing - 2, Cisco CCNA Cisco CCNA 7 min Click to view videos
Packet Tracer Intro to Routing - 3, Cisco CCNA Cisco CCNA 8 min Click to view videos
Packet Tracer Intro to Routing - 4, Cisco CCNA Cisco CCNA 7 min Click to view videos
2 Cisco routers & 2 clients in a simple 3 network layout -part1 Cisco CCNA 11 min Click to view videos
2 Cisco routers & 2 clients in a simple 3 network layout -part2 Cisco CCNA 10 min Click to view videos
2 Cisco routers & 2 clients in a simple 3 network layout -part3 Cisco CCNA 10 min Click to view videos
2 Cisco routers & 2 clients in a simple 3 network layout -part4 Cisco CCNA 6 min Click to view videos
How many broadcast domains? Diagram Question CCNA Cisco CCNA 7 min Click to view videos
Subnetting, Cisco CCNA, Binary Numbers -Part 1 Cisco CCNA 7 min Click to view videos
Subnetting, Cisco CCNA, Binary Numbers -Part 2 Cisco CCNA 5 min Click to view videos
Subnetting, Cisco CCNA, IP Addresses and Binary -Part 3 Cisco CCNA 4 min Click to view videos
Subnetting, Cisco CCNA, IP Addresses, Netmasks & Binary -Part 4 Cisco CCNA 7 min Click to view videos
Find the Private IP Addresses Question Cisco CCNA 6 min Click to view videos
Subnetting Cisco CCNA -Part 1 The Magic Number Cisco CCNA 9 min Click to view videos
Subnetting Cisco CCNA -Part 2 The Magic Number Cisco CCNA 6 min Click to view videos
Subnetting Cisco CCNA -Part 3 The Magic Number Cisco CCNA 10 min Click to view videos
Subnetting Cisco CCNA -Part 4 The Magic Number Cisco CCNA 9 min Click to view videos
Subnetting Cisco CCNA -Part 5 The Magic Number Cisco CCNA 5 min Click to view videos
Subnetting Cisco CCNA -Part 6 The Magic Number Cisco CCNA 5 min Click to view videos
Subnetting - Classful Netmasks - part1 Cisco CCNA 9 min Click to view videos
Subnetting - ANDing - part2 Cisco CCNA 10 min Click to view videos
Subnetting - Finding the Subnets - part3 Cisco CCNA 9 min Click to view videos
Find the Subnet Question Made Easy -part4 Cisco CCNA 5 min Click to view videos
Samurai Cisco Subnetting - part5 Cisco CCNA 9 min Click to view videos
Sample Subnetting Question - Cisco CCNA - part6 Cisco CCNA 5 min Click to view videos
Class A Subnetting Cisco CCNA 5 min Click to view videos
Class B Subnetting with a Class C Address Cisco CCNA 6 min Click to view videos
What is the subnet? Easy Solution Cisco CCNA 9 min Click to view videos
Solving Subnetting Questions for the Cisco CCNA - 1 Cisco CCNA 8 min Click to view videos
How to work with VLSM in the Cisco CCNA -Part1 Cisco CCNA 8 min Click to view videos
How to work with VLSM in the Cisco CCNA -Part2 Cisco CCNA 9 min Click to view videos
Solve a VLSM subnet problem - Cisco CCNA Cisco CCNA 12 min Click to view videos
Subnet a network and provide additional subnets Cisco CCNA 10 min Click to view videos