Stacks and Queues are incredibly useful in concurrent programming, just as in sequential programming.
The new ConcurrentQueue<T>
and ConcurrentStack<T>
classes provide a very nice, thread-safe implementation of a Queue and a Stack. These are particularly useful when dealing with multi-threaded producer/consumer scenarios, as both classes are lockless (good for scalability) and threadsafe, as well as fairly performant.
Also, I'd like to point out one thing - you have two misconceptions in your second paragraph. Linked lists are not particularly bad for scalability. Memory allocation ~may~ need to occur regularly (though there are ways to combat this), but often, that is a smaller price to pay than other potential issues in terms of scalability. (This really depends on the scenario...) Also, the new ConcurrentQueue<T>
and ConcurrentStack<T>
classes are not based on a (at least traditional) linked list. They're a lockless class which internally uses a linked list of arrays to hold the elements, more like std::deque.