What's the relation between CPU registers and CPU cache when it comes to cache coherence protocols such as MESI? If a certain value is stored in the CPU's cache, and is also stored in a register, then what will happen if the cache line will be marked as "dirty"? to my understanding there is no gurentee that the register will update it's ...
I have a TI DSP (TMS320F28235 if anyone cares) that I need to implement a FIFO for queueing information between main-loop code and an interrupt. High-speed execution for this queue is very critical but so is proper operation, and I'm not sure whether I can get away with implementing a FIFO without any explicit synchronization, or if not,...
Hi
I need to design a thread-safe logger. My logger must have a Log() method that simply queues a text to be logged. Also a logger must be lock-free - so that other thread can log messages without locking the logger. I need to design a worker thread that must wait
for some synchronization event and then log all messages from the queue...
In theory, it should be possible to at least brute force a verification of a lock-free algorithm (there are only so many combinations of function calls intersecting). Are there any tools or formal reasoning processes available to actually prove that a lock-free algorithm is correct (ideally it should also be able to check for race condit...
Imagine a program with two threads. They are running the following code (CAS refers to Compare and Swap):
// Visible to both threads
static int test;
// Run by thread A
void foo()
{
// Check if value is 'test' and swap in 0xdeadbeef
while(!CAS(&test, test, 0xdeadbeef)) {}
}
// Run by thread B
void bar()
{
while(1) {
...
Hi, I'm looking for a lock-free design conforming to these requisites:
a single writer writes into a structure and a single reader reads from this structure (this structure exists already and is safe for simultaneous read/write)
but at some time, the structure needs to be changed by the writer, which then initialises, switches and writ...
I was reading through an answer that Jon Skeet gave to a question and in it he mentioned this:
As far as I'm concerned, lock-free multi-threading is for real threading experts, of which I'm not one.
Its not the first time that I have heard this, but I find very few people talking about how you actually do it if you are interested i...
A byte stream should be transferred and there is one producer thread and a consumer one.
Speed of producer is higher than consumer most of the time, and I need enough buffered data for QoS of my application.
I read about my problem and there are solutions like shared buffer, PipeStream .NET class ...
This class is going to be instantiate...
Hello,
I am looking for a method to implement lock-free queue data structure that supports single producer, and multiple consumers. I have looked at the classic method by Maged Michael and Michael Scott (1996) but their version uses linked lists. I would like an implementation that makes use of bounded circular buffer. Something that us...
Possible Duplicate:
Is there a production ready lock-free queue or hash implementation in C++
I am looking for a well-tested, publicly available C/C++ implementation of a lock free queue.
I need at least multiple-producers/single-consumer functionality. Multiple-consumers is even better, if exists.
I'm targetting VC's _Inter...
In this paper: Lock-Free Data Structures (pdf) the following "Compare and Swap" fundamental is shown:
template <class T>
bool CAS(T* addr, T exp, T val)
{
if (*addr == exp)
{
*addr = val;
return true;
}
return false;
}
And then says
The entire procedure is atomic
But how is that so? Is it not possible that some ...
I intend to perform opening for reading a single file from many threads using std::ifstream. My concern is if std::ifstream is thread-safe & lock-free?
More details:
I use g++ 4.4 on Ubuntu & Windows XP, 4.0 on Leopard.
Each thread creates its own instance of std::ifstream
Thanks in advance!
...
let's say i have variables A, B and C that two threads (T1, T2) share.
i have the following code:
//T1
//~~
A = 1;
B = 1;
C = 1;
InterlockedExchange(ref Foo, 1);
//T2 (executes AFTER T1 calls InterlockedExchange)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InterlockedExchange(ref Bar, 1);
WriteLine(A);
WriteLine(B); ...
I've been thinking of how to implement a lock-free singly linked list. And to be honest, I don't see many bullet proof ways to do it. Even the more robust ways out there that use CAS end up having some degree of the ABA problem.
So I got to thinking. Wouldn't a partially lock-free system be better than always using locks? May some oper...
Joe Duffy, gives 6 rules that describe the CLR 2.0+ memory model (it's actual implementation, not any ECMA standard) I'm writing down my attempt at figuring this out, mostly as a way of rubber ducking, but if I make a mistake in my logic, at least someone here will be able to catch it before it causes me grief.
Rule 1: Data dependence ...
is there any C++ implementation (source codes) of "optmistic approach to lock-free FIFO queues" algorithm?
...
do they exist ?
*added to clarify:
is there any usable library that implement lock-free (which is threadsafe and might be implement spinlock or other lightweight synchronization) ObjectPool ( http://en.wikipedia.org/wiki/Object_pool_pattern ) written in C++ language using template?
...
Hi,
I was wondering if the fifo queue presented in Fober et al's paper http://nedko.arnaudov.name/soft/L17_Fober.pdf was a multiple consumer and produce fifo queue. If not, which is the best documented multiple consumer and producer FIFO queue?
Thanks
...
I am trying to improve my understanding of memory barriers. Suppose we have a weak memory model and we adapt Dekker's algorithm. Is it possible to make it work correctly under the weak memory model by adding memory barriers?
I think the answer is a surprising no. The reason (if I am correct) is that although a memory barrier can be used...
I need to implement a lock-free skip list. I tried to look for papers. Unfortunatly all I found was lock-free single linked lists (in many flavors). However how to implement lock-free skip list?
...