Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] Coding blog: lockless queues
Date: Thu, 10 Jan 2013 11:59:42 -0500	[thread overview]
Message-ID: <20130110165942.GA5133@Krystal> (raw)

Hi Rusty!

I've stumbled on your blog post: http://rusty.ozlabs.org/?p=317

and I find that you looked at the RCU lock-free queue implementation in
the Userspace RCU project, but not at the wait-free concurrent queue
implementation we have (wait-free enqueue, blocking dequeue), which does
not require RCU at all and might be a much better fit for what you are
trying to achieve.

A quick pointer to the implementation:

git://git.lttng.org/userspace-rcu.git  master branch
files:

urcu/wfcqueue.h (public API)
urcu/static/wfcqueue.h (API implementation)
(https://git.lttng.org/?p=userspace-rcu.git;a=blob;f=urcu/static/wfcqueue.h;h=4b3535aaa83207a4f4eb801dc63150bef8f28bbc;hb=HEAD)

Some nice features of this wfcqueue is to allow this:

- enqueue is wait-free (uses xchg() and store),
- splice (a kind of dequeue_all) from queue is only needs mutual
  exclusion with other dequeue, but not with other splice. We call it
  "blocking" because it may have to busy-wait if enqueue is preempted
  between xchg and store,
- synchronization needed when iterating on the queue (so we wait for
  store to complete if we reach a node being enqueued) is performed
  at the very last moment where it is needed: this is why we provide
  "first" and "next" iterators.
- we also support "dequeue", to dequeue nodes one by one. The dequeue
  operation needs mutual exclusion against other dequeue acting on that
  queue (and against first/next iterators).

I'd be very interested to hear feedback from you on this implementation.

Thanks!

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



             reply	other threads:[~2013-01-10 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 16:59 Mathieu Desnoyers [this message]
2013-01-21 22:59 ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130110165942.GA5133@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox