Queuing Models in NS2

Image
M/M/1 is a system with poisson arrival time, servicing exponentially and a queue of unlimited capacity and type of FIFO Queue. This is the simplest queuing system.  NS2 supports various distributions like pareto, exponential, constant, unifrom, etc to handle the network dynamics and metrics. So it is very easy to test the given network link to monitor a given queue using any of these queuing models. The listing 3 and 4 are monitoring the link when DropTail queue is used with a capacity of finite and infinite. Listing 13.3 uses infinite capacity and Listing 13.4 uses Finite capacity The output screen shot is shown below the scripts for further understanding
Listing 3 – M/M/1 Queuing Model #new Simulator creation set ns [new Simulator] #trace file creation for capturing the UDP data set tf [open out.tr w] $ns trace-all $tf
#setting the exponential distribution param set lambda 30.0 set mu     33.0
#creation of nodes set n1 [$ns node] set n2 [$ns node] #The queue limit is 1Lakh as the capacity is infin…

C Programming - Introduction

This post and the subsequent posts will help you in understanding the intricacies of C programming. These posts just shows you the basics of C programming and some worked examples for that. 
C
C Program with Linux

Features of C Programming
  • C is a small language having lesser number of keywords than Java or pascal.
  • C is a native language of Unix, Linux. Not only that many of the windows packages, database programs, graphics libraries are written in C program
  • C is portable – it provides standard set of libraries that work on the same way with all machines
  • C is modular, as it supports functions to divide the program in to sub program
  • C is efficient on most machines, because certain constructs are machine dependant.
Structure of a C program
  • Comments
    • the comments are usually ignored by the compiler
    • so this part informs about the author of the program
    • what is the usefulness of this program
    • updation or creation of the program
    • Example: //  - Single line comment
    • /* ----- multi line comments    ….*/
  • Preprocessor Directives
    • before the compiler runs, the preprocessing takes place.
    • the preprocessors are prefix with a symbol #
    • Examples: #include, #define, #ifdef, #pragma, etc.
  • Function prototypes
    • This is to inform the compiler that the following functions are defined in this program.
    • it specifies the name of the function, arguments or parameters and return type and it ends with a semicolon
    • Ex: int sum(int,int);
  • Global Variables
    • Global variables which are declared above all the functions
    • As the name says, they are available to all the functions of that program
    • They are usually stored in the RAM
  • Main Function
    • main is the function which is main to the entire program
    • Every C program should have a main function
    • syntax: int main() { }
    • Earlier, the main program will return nothing, ie void, but now the compilers are instructing us to provide a return type for the main() function
  • User defined functions
    • After the main() function, the user defined functions are defined, as per the function prototype declared in the program
    • The function can be defined above the main function also, in that case there is not need for function prototype
    • Syntax:
int sum(int a, int b)
{
int f;
f=a+b;
return f;
}

 T S Pradeep Kumar

Popular posts from this blog

AWK Scripts for NS2 to process data from Trace Files

Xgraph

ns2 installation in Ubuntu 14.04