Free Tutorials, Linux Command, Source Code Architecture,  Software Engineering, Intelligent Systems, RDBMS, Computer Accounting,  Operations Research, Discrete Mathematics, Network, SAD Lay Networks Lay Networks
Computer Science Networking Operating Systems Linux and Unix Source Code Script & Languages Protocols Glossary
 


ALOHA PROTOCOL IN C - LANGUAGE (Updated - inputs by Thilip)

#include <stdio.h>
#include <math.h>
#include <time.h>
#include <dos.h>

#define FRAME_TIME 250

main()
{
float S1, S2, G, J, val[100] ;
int I, n, K, delay ;
void wait() ;
clrscr() ;
printf("Please Give the Total Load : ");
scanf("%d", &n);
printf("Please Enter the value of load \n");
for (I=0; I<n; I++)
{
scanf("%f", &val[I]);
}
clrscr();
printf("\nOUTPUT 1: (THROUGHPUT Vs LOADCURVE)\n\n");
printf("s=g*exp(-G) FOR SLOTTED ALOHA * \n");
printf("s=g*exp(-2G) FOR PURE ALPHA #\n");
printf("\n------ (THROUGHPUT PER FRAME TIME)----\n");
for(K=0; K<n; K++)
{
G=val[K];
S1 = G * exp (-G);
S2 = G * exp(-2 * G);
printf("%1.3f", G );
for (I=0; I <=S1*20; I++)
{
printf(" ");
}
printf("*");
for(I=S2*20; I<=S2*75; I++ )
{
printf(" ");
}
printf("#\n");
}
printf("G (ATTEMPTS PER PACKET TIME) \n\n");
wait() ;
getch() ;
clrscr() ;
printf("\nOUTPUT 2 (DELAY Vs THROUGHPUT) \n\n");
printf("\n-----(THOUGHPUT PER FRAME TIME)----\n");
for(K=0; K<n; K++)
{
G=val[K];
S1 = G * exp (-G);
printf("3");
for (I=0; I <=S1*2.7; I++)
{
printf(" ");
}
printf("*\n");
}
printf("\n");
printf("---- DELAY -----");
wait();
getch();
clrscr();
}

void wait()
{
sound(440);
delay(300);
nosound();
}

OUTPUT of (THROUGHPUT V/S LOADCURVE)

s=g*exp(-G) FOR SLOTTED ALOHA *

s-g*exp(-2G) FOR PURE ALPHA #

-----------(THROUGHPUT PER FRAME TIME) ----->

0.0000003   *  #

0.5000003                     *                                  #

1.0000003                        *                                          #

1.5000003                     *                                        #

2.0000003                  *                                #

2.5000003               *                        #

3.0000003         *                    #

3.5000003         *            #

G (ATTEMPTS PER PACKET TIME)

OUTPUT of (DELAY V/S THROUGHPUT)

------(THROUGHPUT PER FRAME TIME) ---->

3 *

3*

3*

3*

3*

3*

3*

3*

3*

--- DELAY------


Slotted Aloha
Pure Aloha
Aloha and Network Stability
Aloha Simulation & Reservation Aloha Protocol
Slotted ALOHA Simulation Parameters
ALOHA PROTOCOL IN C - LANGUAGE

1. FDDI Frequently Asked Questions (FAQ)

2. The function and frame format of FDDI.

3. Aloha

4. Comparative analysis between two types of ATM Switches
a) The Knockout Switch
b) The Barcher-Banyan Switch

5. Various popular standards for compressing multimedia data

6. Distributed Multimedia Survey: Standards

7. ASCII to hex value chart

8. Comparative analysis - TCP - UDP

9. Addressing Formats and QoS parameters

10.Bellman Ford's Algorithm

Top

Back
Next
free computer articles
 

Copyright © 2000- 2008 Lay Networks All rights reserved. 

Web Hosting sponsored by Customized Software Company India
Web Site Designed by Web Designing, Flash Animation, Multimedia Presentations, Broacher/catalogue designing, Web Promotion 
Refer to your freind About Us Legal IGNOU Contact Us Feedback Donate to laynetworks.com Download Management Tutorials Tutorials History Search here