[Click] Conversion of threads

Cliff Frey cliff at meraki.com
Thu Feb 24 11:12:19 EST 2011


I wanted to benchmark the difference between ThreadSafeQueue and
one-queue-per-thread + RoundRobinScheduler + Unqueue + another-Queue.
 However, I ended up finding a bug.

This config:

elementclass Foo {
  is :: InfiniteSource -> [0] output;
};
f0::Foo,f1::Foo,f2::Foo,f3::Foo,f4::Foo,f5::Foo

-> master_q :: ThreadSafeQueue
-> uq2 :: Unqueue
-> c :: Counter(COUNT_CALL 4000000 stop)
-> Discard;
StaticThreadSched(
f0/is 0,
f1/is 1,
f2/is 2,
f3/is 3,
f4/is 4,
f5/is 5
uq2 7);

When run with 'click --threads=8 foo.click' ends up getting suck, with an
empty master_q and none of the infinitesource elements scheduled.  I'm
running on a i7 CPU with 4 cores + hyperthreading, giving 8 CPUs from
linux's perspective.

Also interesting is how many drops will be seen at the queue in this case
(not too surprising really)

read f0/is.scheduled
false
read master_q.length
0
read master_q.drops
163540
read c.count
231797

Cliff

On Thu, Feb 24, 2011 at 7:27 AM, Eddie Kohler <kohler at cs.ucla.edu> wrote:

> Try ThreadSafeQueue at the converge point, which as Bobby points out should
> be
> correct even when multithreaded, but doesn't require locks.  However, it
> will
> still be slowish, as would be anything that tried to enforce strict order,
> since the queue pointers will bounce among cores.
>
> Eddie
>
>
> On 2/23/11 9:36 PM, Philip Prindeville wrote:
> > I was wondering... if I'm running multiple duplicate paths each on its
> own core and I eventually need to collect them up so I can resequence
> packets and pass them up into user-space... how feasible is it to go from
> threaded and lockless to converging into a single locked queue (fan-in)?
> >
> > I figure it would be the best of both worlds because most of the
> operations could happen threaded and without locking, and the locking only
> needs to be enforced in the final stage...
> >
> > Thanks.
> >
> > -Philip
> >
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list