rmind / libqsbr Goto Github PK
View Code? Open in Web Editor NEWQSBR and EBR library
License: BSD 2-Clause "Simplified" License
QSBR and EBR library
License: BSD 2-Clause "Simplified" License
I've been reading over the source for libqsbr - it looks like a great library which I'd like to use in a few applications, however I'm confused about one aspect of the design. Specifically, regarding the code that inserts removed elements into the limbo list - why is this code not thread-safe? I mean, the code for gc_limbo
, for example, does not use any memory barriers or atomic instructions when it adds the removed element into the limbo list. And the limbo list is not thread-local. Yet, the example in the README file indicates that we can call gc_limbo
from any random worker thread. So how is this possible?
It would seem that since gc_limbo
does not use memory barriers or atomic instructions, it would only be safe to call it from one thread - perhaps a specially designated "reclamation thread" or something - except the README seems to imply we can call gc_limbo
from any arbitrary worker thread. I'm very confused about this issue, and would appreciate any insight into how gc_limbo
is supposed to work.
Thanks
This assertion checks if qsbr_epoch_t
is a 64 bit type:
static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
However, the code defines qsbr_epoch_t
to be of type
typedef unsigned long qsbr_epoch_t;
which may be a 32 bit type. Please change the code such that qsbr_epoch_t
is instead a 64 bit type:
typedef unsigned long long qsbr_epoch_t;
Hey - I was wondering about the full memory barriers (atomic_thread_fence with memory_order_seq_cst) in the EBR library.
Thinking about it, isn't it true that ebr_enter and ebr_exit essentially have acquire/release semantics? Could you get away with simple acquire/release memory ordering, instead of a full memory_order_seq_cst?
It would seem that in ebr_sync, when scanning all threads, if a LOAD-acquire is used to read each local epoch, this would "synchronize-with" all release operations in ebr_exit, guaranteeing a "happens-before" relationship with the thread doing ebr_sync and all threads that have exited a critical section.
So, doesn't this imply that EBR could get away with simple acquire/release memory ordering, rather than full memory barriers with memory_order_seq_cst?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.