[Ns-developers] [ns3] socket API

Gustavo Carneiro gjcarneiro at gmail.com
Mon Apr 21 15:50:09 PDT 2008


On 21/04/2008, Mathieu Lacage <mathieu.lacage at sophia.inria.fr> wrote:
>
>
> On Mon, 2008-04-21 at 13:24 -0400, George Riley wrote:
>
> > Both types of threads also of course each need a private stack, and
> > the required size of this stack is not always
> > obvious.  A user will have to balance the need for stack space against
> > total available
> > memory and choose a good value that is "big enough", but not "too big".
>
>
> It is also possible to make the stacks grow on-demand (at least, on
> linux): these stacks need to be page-aligned and their size must be
> multiples of the page size (which will suck at least 4K per stack). This
> tends to eat virtual space really quickly on 32 bit systems because each
> stack eats 2 pages of virtual space (which is 8K, even if only 1 page is
> used) and, it fills the kernel virtual page mapping data structures with
> lots of very small memory mappings which tends to kill page cache lookup
> performance :/
>
> So, I guess that simulating 5000 processes is definitely within reach of
> even moderately-sized systems (something like 50MBs of RAM for 8K
> stacks) but, going beyond that will probably be an interesting problem
> on desktop-class machines.


If all it takes is 50 MB of RAM for 5000 processes, that is actually pretty
good and much smaller overhead than I expected.   OTOH, a kernel having to
schedule among 5000 threads, that may be large overhead in terms of CPU, and
very platform dependent (Linux nowadays has a O(1) scheduler, but other
systems may not be so lucky).

If the overhead of simulated processes is small, I have absolutely no
objection regarding their use NS-3 models.  On the contrary, it makes code
much easier to read.  OTOH, if we don't know the performance implications of
this approach then I think it is ill advised to say it's ok to use simulated
processes all the time, since we might regret the decision later if it is
discovered that performance suffers significantly.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list