Query about dequeuing from a random queue position

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Query about dequeuing from a random queue position

nandita gurunathan
Hello everyone,

I am trying to implement an AQM algorithm in ns-3 which requires that a
packet should be dropped at a random position in the queue. When I tried to
do this, I found that:

- Class Queue has a protected function DoDequeue which takes Constiterator
as argument. This function dequeues a packet at the given position.

- DropTailQueue implements Queue and it has a public function Dequeue()
which calls DoDequeue() with ConstIterator as Tail. DropTailQueue does not
have a function which calls DoDequeue with iterator pointing to a random
position.

I think I can add such a function in DropTailQueue and include at in my
qdisc or should I write a new queue implementing queue class with a method
which can call DoDequeue() at a random position?

Can anyone suggest what is the right way to achieve this? I'm using
ns-3-dev.

Thanks,
Nandita
Reply | Threaded
Open this post in threaded view
|

Re: Query about dequeuing from a random queue position

Stefano Avallone
The best way is to create a new Queue subclass (DropTail is not meant to dequeue packets at random positions) which provides     a Dequeue method (or a DequeueRandom method, your subclass can provide as many dequeue methods as you wish) that determines the position of the element to dequeue and calls DoDequeue by passing such position.

Bests,
Stefano

> On 16 Jun 2017, at 12:05, nandita gurunathan <[hidden email]> wrote:
>
> Hello everyone,
>
> I am trying to implement an AQM algorithm in ns-3 which requires that a
> packet should be dropped at a random position in the queue. When I tried to
> do this, I found that:
>
> - Class Queue has a protected function DoDequeue which takes Constiterator
> as argument. This function dequeues a packet at the given position.
>
> - DropTailQueue implements Queue and it has a public function Dequeue()
> which calls DoDequeue() with ConstIterator as Tail. DropTailQueue does not
> have a function which calls DoDequeue with iterator pointing to a random
> position.
>
> I think I can add such a function in DropTailQueue and include at in my
> qdisc or should I write a new queue implementing queue class with a method
> which can call DoDequeue() at a random position?
>
> Can anyone suggest what is the right way to achieve this? I'm using
> ns-3-dev.
>
> Thanks,
> Nandita
>


Reply | Threaded
Open this post in threaded view
|

Re: Query about dequeuing from a random queue position

nandita gurunathan
Thanks for your reply.

On Sat, Jun 17, 2017 at 3:15 PM, Stefano Avallone <[hidden email]> wrote:

> The best way is to create a new Queue subclass (DropTail is not meant to
> dequeue packets at random positions) which provides     a Dequeue method
> (or a DequeueRandom method, your subclass can provide as many dequeue
> methods as you wish) that determines the position of the element to dequeue
> and calls DoDequeue by passing such position.
>
> Bests,
> Stefano
>
> > On 16 Jun 2017, at 12:05, nandita gurunathan <[hidden email]>
> wrote:
> >
> > Hello everyone,
> >
> > I am trying to implement an AQM algorithm in ns-3 which requires that a
> > packet should be dropped at a random position in the queue. When I tried
> to
> > do this, I found that:
> >
> > - Class Queue has a protected function DoDequeue which takes
> Constiterator
> > as argument. This function dequeues a packet at the given position.
> >
> > - DropTailQueue implements Queue and it has a public function Dequeue()
> > which calls DoDequeue() with ConstIterator as Tail. DropTailQueue does
> not
> > have a function which calls DoDequeue with iterator pointing to a random
> > position.
> >
> > I think I can add such a function in DropTailQueue and include at in my
> > qdisc or should I write a new queue implementing queue class with a
> method
> > which can call DoDequeue() at a random position?
> >
> > Can anyone suggest what is the right way to achieve this? I'm using
> > ns-3-dev.
> >
> > Thanks,
> > Nandita
> >
>
>