I have created a concurrent, recursive directory traversal and file processing program, which sometimes hangs after all parallel computations have finished but the 'primary' thread never continues with other tasks.
The code is basically a fork-join style concurrent aggregator, and after the parallel aggregation completes, it should dis...
I will often need to translate from the string code into its Enum type.
See snippet below. I think this is highly inefficient. How can I improve
the method deref so that:
It will be threadsafe.
It is faster.
Code:
public enum SigninErrorCodes
{
InvalidUser("a0"), InvalidPassword("b5"), NoServerResponse("s2");
SigninErrorCod...
When using multiple threads, shared memory needs to be locked by critical sections. However, using critical sections causes potential deadlocks. How can they be avoided?
...
Multithreading is hard. The only this you can do is program very carefully and follow good advice. One great advice I got from the answers on this forum is to avoid mutable state. I understand this is even enforced in the Erlang language. However, I fail to see how this can be done without a severe performance hit and huge amounts of cac...
I am looking for a cross-platform C++ master/worker library or work queue library. The general idea is that my application would create some sort of Task or Work objects, pass them to the work master or work queue, which would in turn execute the work in separate threads or processes. To provide a bit of context, the application is a C...
The problem i have is i could DELETE but then when i hit refresh and send the post data it will try to delete again. Which isnt a problem but now the second statment is a problem since it decreases when it shouldnt.
What is a concurrent safe way to decrease but only if delete has removed an entry? note msgId is a PK so i'll either dele...
I'm a pretty young developer, and still in the emulation phase of my career. I have read a lot about some topics like concurrency, and using unit of work to allow your business layer to control persistence transactions. I have even implemented some painful, but functional code that implements these topics. But I have not really ever se...
I'm seeing OraclePreparedStatement executeQuery() exhibit serialization. That is, I have two queries that I want to run concurrently against an Oracle database, using the same connection. However, the OraclePreparedStatement seems to explicitly prohibit concurrent queries.
My question is: Is this serialization a necessary artifact of...
I'm working on an application that is divided in a thin client and a server part, communicating over TCP. We frequently let the server make asynchronous calls (notifications) to the client to report state changes. This avoids that the server loses too much time waiting for an acknowledgement of the client. More importantly, it avoids dea...
When running the following class the ExecutionService will often deadlock.
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ExecutorTest {
p...
Hi,
I am currently using powerbuilder 6.5
In my application, i want to make a code where any change in one window should reflet another window.Two windows are using the same table. if we channge in one window it is not reflecting in another window if the other window is opened earlier. what cani do?
...
I have a situation in C# where I have a list of simple types. This list can be accessed by multiple threads: entries can be added or removed, and the existence of an entry can be checked. I have encapsulated the list in an object exposing just those three operations so far.
I have a few cases to handle (not exactly the same as the meth...
What's the best way to implement a Hash that can be modified across multiple threads, but with the smallest number of locks. For the purposes of this question, you can assume that the Hash will be read-heavy. It must be thread-safe in all Ruby implementations, including ones that operate in a truly simultaneous fashion, such as JRuby, an...
I would like to cache some IO with the help of ConcurrentHashMap. The modification on the binary file should be reflected in cache as well. Since the cache is going to be used by multiple threads all IO operations are synchronized. Modifications of map go inside the same synchronized block. Which roughly looks like:
synchronized (file) ...
I'm currently working on a multi-threaded application, and I occasionally receive a concurrently modification exception (approximately once or twice an hour on average, but occurring at seemingly random intervals).
The faulty class is essentially a wrapper for a map -- which extends LinkedHashMap (with accessOrder set to true). The clas...
What should I use to get semantics equivalent to AutoResetEvent in Java?
(See this question for ManualResetEvent).
...
Executor seems like a clean abstraction. When would you want to use Thread directly rather than rely on the more robust executor?
...
I have a scenario where I want to have a question object and users can concurrently add answer objects to the question object.
The question object needs to maintain the answer count.
How can I do an implementation in Linq2Sql that transactionaly saves the answer object that the user submitted to the question and updates the incremented...
Hello. I have some problem with CompletionService.
My task: to parse parallely for about 300 html pages, i need to wait for all the results only for 5 seconds, then - return the result to main code.
I`ve decided to use CompletionService + Callable for this.
The question is how to stop all threads, that were caused by CompletionService a...
Could anyone create a short sample that breaks, unless the [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] is applied?
I just ran through this sample on MSDN and am unable to get it to break, even if I comment out the ReliabilityContract attribute. Finally seems to always get called.
...