[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Agents in C++ or OTcl?



> > There are two flavors of simulation in ns: writing Agents in C++ as in
> > the tcp related simulations and writing Agents in Otcl as in multicast
> > related stuff. I personally prefer the former, but I'd like to hear 
> > some analysis from the experts, especially on the performance, memory 
> > consumption, debuging, etc.

here are my $0.02:

We used OTcl to write almost all the code for the detailed multicast routing 
protocols (the versions of PIM-SM/DM supported by ns)...

The only part in C++ (in terms of agents) is the (erroneously called!) prune 
agent (prune.cc) which handles simple header manipulations and packet 
send/rcv primitives [similar to a socket layer]
(it does not handle only prune messages as the name implies).

The OTcl classes extend such agent to provide protocol specific 
functionality.

In terms of performance, only the protocol messaging is processed by 
these agents, and hence you don't incur per-packet performance hit.
[the multicast forwarding machinery is done in C++... this is similar to 
the kernel forwarding cache, and the multicaast routing daemon, split in 
the unix OS architecture].

In terms of flexibiliy, you get an extensible way to implement various 
protocol functionalities using the same primitives (... I like to think 
of it as a socket-like layer..).
Also, you don't need to recompile the code every time you change 
something... so it gives less turnaround time.

As for memory, OTcl objects definitely occupy a lot more space, than do 
C++ objects.
[this subject was discussed recently by the vint folks, that's why I am 
so confident on this one.. :-)]

Regards,
-A