tempesta-tech / blog Goto Github PK
View Code? Open in Web Editor NEWOur open source benchmarks and code samples
Home Page: http://tempesta-tech.com/blog/
License: GNU General Public License v2.0
Our open source benchmarks and code samples
Home Page: http://tempesta-tech.com/blog/
License: GNU General Public License v2.0
Hi Krizhanovsky, thank you for your such good job about transactional memory, I run the code tsx.cc, but I'm very confused that why conflicts happen in the case of independent location? in these lines https://github.com/natsys/blog/blob/master/tsx.cc#L153-L158, when overlap is zero, each thread access their own data location, I think it's not need to lock the data by spin lock way. and no conflicts will happen by tsx way?
Thank you for your nice work.
Here is my two question harassing my brain,
// Force compiler to use tmp_h exactly once.
mean? Need here a compiler barrier?thr_pos().head = ULONG_MAX;
and thr_pos().tail = ULONG_MAX;
, after the specified element read / written?Can you add license text to some of the examples? Currently, it's unclear as to what their licenses are.
last_head_ and last_tail_ are not marked as volatile in lockfree_rb_q.cc. Per the article in http://www.linuxjournal.com/content/lock-free-multi-producer-multi-consumer-queue-ring-buffer?page=0,3, doesnt it need to be marked volatile ? Or does builtin_expect automagically force the compile to load last_head_ and last_tail_ from memory everytime ?
If it is not volatile, it seems like it will be a bug.
Please forgive me if I'm missing something here...
in lockfree_rb_q.cc class LockFreeQueue, there appear to be two issues related to ulong overflow (wrap around).
the ULONG_MAX "parking value" is not excluded from reservation, nor from "min" testing. the "invalid" value can't ever be used as a valid value, nor compared with them
the comparison for min testing will be incorrect if the span of thread specific head and tail values crosses overflow
There appear to be two choice -- compared the signed distance, If the max difference is representable in long, will give the correct comparison (if the difference isn't, then one push of pop isn't making forward progress... or you have more than 2 billion threads)
( 0 < long(min - tmp_[ht})
Slightly more robust (it could handle a ULONG_MAXth old pending request :) ) would be comparing the head - tail values -- guaranteed to be positive and correctly comparable -, though eventually a hung push or pop operation would stall all operations.
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.