Queuing Models in NS2

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…

Time Command in Linux

The time command is linux is very much useful if you want to know the time information while running a program or a process.
The time command usage is as followsprompt $] time <commandname>
prompt $] time ls
The output will be
If you want to see the detailed system parameters occupied during a program or process, then the command will be
prompt$] TIMEFORMAT=”” time -v <commandname>
See the screenshot given below
time command
Time Command in Linux

The output of the above command is
Desktop  Documents  Downloads  examples.desktop  MusicPictures  Public  Templates  Videos
Command being timed: “ls”
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 400%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 3600
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 286
Voluntary context switches: 1
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Similarly, if a C or C++ program is compiled and linked to a file called helloc (the creation of helloc is given below)
prompt $] gcc -o helloc hello.c 
prompt $] g++ -o helloc tspradeep.cc 
if you want to execute this command 
prompt $] TIMEFORMAT=”” time -v ./helloc
The time command will show you the memory page faults, context swtiching, swap memory used and other system parameters, etc.
If you have any added input for this command, let you write in the comment section.
T S Pradeep Kumar

Popular posts from this blog

AWK Scripts for NS2 to process data from Trace Files


LEACH protocol installation in ns2 (ns-2.35)