Concurrent data structures:
[1] http://www.cs.tau.ac.il/~shanir/concurrent-data-structures.pdf
[2] http://en.wikipedia.org/wiki/Concurrent_data_structure
Are concurrent data structures and thread safe data structures interchangeable terms?
Concurrent data structures:
[1] http://www.cs.tau.ac.il/~shanir/concurrent-data-structures.pdf
[2] http://en.wikipedia.org/wiki/Concurrent_data_structure
Are concurrent data structures and thread safe data structures interchangeable terms?
My understanding differs from @xxa (the answer is: No). Though I have no a regious definition either. Concurrent
implies thread-safety. But nowadays, it implies simultaneous access as well. While thread-safety gives no such assumptions. See this quote form the mentioned Wiki-article:
Today, as multiprocessor computer architectures that provide parallelism become the dominant computing platform (through the proliferation of multi-core processors), the term has come to stand mainly for data structures that can be accessed by multiple threads which may actually access the data simultaneously because they run on different processors that communicate with one another.
For example, STL containers are claimed to be thread-safe for the given conditions (read-only), moreover, it allows simultaneous reads by a number of threads (STL says them are "as safe as int"), but only one thread can modify them and in absence of readers. Can we name them 'concurrent'? No. While practical concurrent containers (see tbb for example) allow at least two or more threads to work with the container (including modification) at the same time.
And one more point. You could implement std::queue
so that methods push() and pop() will not trigger a failure when used by different threads. But does this make it a concurrent_queue
? No. Because, queue::front()
and queue::pop()
do not provide a way to get elements simultaneously by two or more threads without external synchronization. To become a concurrent_queue
it needs different interface, which takes care of atomicity by combining pop() with returning the value.
These terms do not have a rigorous definition, but in general it can be asserted that the answer to your questions is yes. Both refer to data structures that are stored in shared memory (http://en.wikipedia.org/wiki/Shared_memory) and manipulated by several threads or processes.
In fact [1] asserts the same when it refers to threads explicitly:
The primary source of this additional difficulty is concurrency: Because threads are executed concurrently on different processors, ..."