ck_ring_dequeue_mpmc fails with concurrent producers and consumers

64 views
Skip to first unread message

Nookala Poornima

unread,
Apr 29, 2017, 11:28:19 PM4/29/17
to Concurrency Kit
I am trying to benchmark ck_ring to see the performance and if it fits my needs, however when I try to launch producer and consumer threads concurrently trying to enqueue and dequeue, program hangs and dequeues don't seem to succeed. Also, in the instances where program doesn't hang, there are many failed dequeues happening. Does ck_ring_mpmc work with multiple producers and consumers running at the same time? I have seen latency.c and validate.c for these methods and enqueue completes before launching dequeue threads in those examples, but my scenario is different. Thanks.

Samy Al Bahra

unread,
Apr 30, 2017, 12:00:46 AM4/30/17
to concurr...@googlegroups.com
Hi Nookala,

I'm not sure which source files you're referring to, as there is no validate.c for ck_ring. There are a few targeted tests that involve concurrent enqueue and dequeue operations (ck_ring_mpmc.c).

A few things to check:
1) Is the ck_ring being initialized with a power-of-2 size? This is required.
2) Is the ck_ring_buffer_t (or in parameterized version, buffer) being allocated and passed correctly?
3) Is enqueue and dequeue running on the same core? Are there potential priority inversion issues?
4) Which architecture are you on? Which compiler is being used?
5) Does your consumer thread ever encounter long periods of preemption?

If these things are being respected and you're still encountering failures, sharing your test program or a small test case will enable me to assist better. Otherwise, I'd love to here what want wrong.

Thanks.

On Sat, Apr 29, 2017 at 11:28 PM Nookala Poornima <nookala....@gmail.com> wrote:
I am trying to benchmark ck_ring to see the performance and if it fits my needs, however when I try to launch producer and consumer threads concurrently trying to enqueue and dequeue, program hangs and dequeues don't seem to succeed. Also, in the instances where program doesn't hang, there are many failed dequeues happening. Does ck_ring_mpmc work with multiple producers and consumers running at the same time? I have seen latency.c and validate.c for these methods and enqueue completes before launching dequeue threads in those examples, but my scenario is different. Thanks.

--
You received this message because you are subscribed to the Google Groups "Concurrency Kit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concurrencyki...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samy Al Bahra

unread,
May 2, 2017, 10:18:47 AM5/2/17
to concurr...@googlegroups.com
Hi Nookala

Did my response help?

On Sat, Apr 29, 2017, 11:28 PM Nookala Poornima <nookala....@gmail.com> wrote:
I am trying to benchmark ck_ring to see the performance and if it fits my needs, however when I try to launch producer and consumer threads concurrently trying to enqueue and dequeue, program hangs and dequeues don't seem to succeed. Also, in the instances where program doesn't hang, there are many failed dequeues happening. Does ck_ring_mpmc work with multiple producers and consumers running at the same time? I have seen latency.c and validate.c for these methods and enqueue completes before launching dequeue threads in those examples, but my scenario is different. Thanks.

--
Reply all
Reply to author
Forward
0 new messages