FastFlow
SVN-r182-Aug-14-2014
A high-level, lock-less, parallel programming (shared-memory) and distributed programming (distributed-memory) framework for multi-cores and many-cores systems
|
This file contains the definition of the unbounded SWSR
circular buffer used in FastFlow.
More...
#include <assert.h>
#include <cassert>
#include <new>
#include <ff/dynqueue.hpp>
#include <ff/buffer.hpp>
#include <ff/spin-lock.hpp>
#include <ff/atomic/atomic.h>
Classes | |
class | ff::uSWSR_Ptr_Buffer |
Unbounded Single-Writer/Single-Reader buffer (FastFlow unbound channel) More... | |
Namespaces | |
ff | |
The principal namespace for the FastFlow library. | |
This file contains the definition of the unbounded SWSR
circular buffer used in FastFlow.
Single-Writer/Single-Reader (SWSR) lock-free (wait-free) unbounded FIFO queue. No lock is needed around pop and push methods!!
The key idea underneath the implementation is quite simple: the unbounded queue is based on a pool of wait-free SWSR circular buffers (see buffer.hpp). The pool of buffers automatically grows and shrinks on demand. The implementation of the pool of buffers carefully try to minimize the impact of dynamic memory allocation/deallocation by using caching strategies.
More information about the uSWSR_Ptr_Buffer implementation and correctness proof can be found in:
M. Aldinucci, M. Danelutto, P. Kilpatrick, M. Meneghin, and M. Torquati, "An Efficient Unbounded Lock-Free Queue for Multi-core Systems," in Proc. of 18th Intl. Euro-Par 2012 Parallel Processing, Rhodes Island, Greece, 2012, pp. 662-673. doi:10.1007/978-3-642-32820-6_65
IMPORTANT:
This implementation has been optimized for 1 producer and 1 consumer. If you need to use more producers and/or more consumers you have several possibilities (top-down order):