[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.
A lot of how you divide the problem in ns appears to
be a matter of taste and style. There are some general
principles though:
- In general, you should place objects related to
per packet activity in C++, simply for reasons of
speed. Per-packet processing via OTcl will make for
*veeerrrrryyy* slow simulations.
- Things to do with control, and control traffic,
such as dynamic routing can be easily done either
in C++ Or OTcl. (The DV routing, RTP, RLM, PIM,
various multicast routing protocols, etc. are
mostly in OTcl, and are examples of this type
of programming paradigm).
- Most people find themselves having a faster
turnaround time when prototyping in a scripted
language. So, (if you are that sort, or otherwise,
expect to run into that sort of people), place such
functionality in OTcl that you expect to play around
with a lot. In SRM, (the example I am most familiar
with), data flow and session message processing was
in C++, but we want to play with the timer algorithms,
scalable approaches to sending session messages,
different loss recovery approaches, etc., and so
these were done in OTcl.
Generally, performance is slow, and memory consumption is high
for OTcl code (I think Polly mentioned this as well); however,
the advantage is rapid prototyping, with the ability to flexibly
explore the protocol design space quickly.
The complexity of having two languages to work with makes
debugging non-trivial as is, but some hacky solutions are
possible. Check out the ns-debugging web page (off the main
ns web page) for tips on debugging.
Kannan