What is the best way to test an implementation of a mutex is indeed correct? (It is necessary to implement a mutex, reuse is not a viable option)
The best I have come up with is to have many (N) concurrent threads iteratively attempting to access the protected region (I) times, which has a side effect (e.g. update to a global) so that t...
Hi,
I'm having issues with concurrent usage of a shared collection with a multi-player synchronous game I'm working on. I did some digging around and found a neat thread-safe IEnumerator/IList implementation on Alexey Drobyshevsky's post on codeproject here:
http://www.codeproject.com/KB/cs/safe_enumerable.aspx
After adopting his impl...
Hi,
I currently have code that does the following:
private final static ExecutorService pool = Executors.newCachedThreadPool();
public void foo(){
FutureTask<MyObject> first_task = createFutureTask();
FutureTask<MyObject> second_task = createFutureTask();
...
pool.execute(first_task);
pool.execute(second_task);
...
I'm using VS1010RC with the POCO self tracking T4 templates.
In my WCF update service method I am using something similar to the following:
using (var context = new MyContext())
{
context.MyObjects.ApplyChanges(myObject);
context.SaveChanges();
}
This works fine until I set ConcurrencyMode=Fixed on the entity and then I get an ex...
I am currently working on a file processing service that looks at a fileshare, where files are uploaded to via FTP.
For scalability I've been asked to make this service to be able to be load balanced, so the service has to expect that other services on different machines may also be trying to process these files.
OK, so I thought I sho...
I have multiple threads that share use of a semaphore. Thread A holds the semaphore (using lock) and threads B and C are waiting on that same semaphore (also using lock). The threads share global variables, etc.
Is there a technique in C# that I can use to shut down thread B? I can set a flag in A and have thread B check that flag and...
I'm wondering if it is possible, that after a collection of rows is inserted, to initiate an operation that is executed asynchronously, is non-blocking, and doesn't need to inform the originator of the request - of the result.
I am working with large amounts of events and I can guarantee that the post-insert logic will not fail -- I jus...
Ferryboats go back and forth, carrying passengers from one side of the canal to the
other. Each boat can hold at most C passengers. The passengers wait for the boats to
ferry them across the canal. A boat can start crossing the river only when it is full. A
boat cannot start loading passengers on one side of the canal if another boat is ...
All of the concurrent programs I've seen or heard details of (admittedly a small set) at some point use hardware synchronization features, generally some form of compare-and-swap. The question is: any there any concurrent programs in the wild where the thread interact throughout there life get away without any synchronization?
Example o...
I've got multiple python processes (typically 1 per core) transforming large volumes of data that they are each reading from dedicated sources, and writing to a single output file that each opened in append mode.
Is this a safe way for these programs to work?
Because of the tight performance requirements and large data volumes I don't ...
We know that DBMS harness many technique to ensure the data integrity and satisfying the ACID properties when there are many transactions running simultaneously in a concurrency environment. Apart from setting Isolation Level, what other means taken by DBMS to ensure data integrity? what is the relationship between these technique? Could...
Our application needs a simple scheduling mechanism - we can schedule only one visit per room for the same time interval (but one visit can be using one or more rooms). Using SQL Server 2005, sample procedure could look like this:
CREATE PROCEDURE CreateVisit
@start datetime, @end datetime, @roomID int
AS
BEGIN
DECLARE @isFreeRoom I...
I am actually on my project on compiler with SMP, and want to code with pthreads and heard about many parallel things open mpi and so on, So to start with how this thread is allocated to core while calling pthread,Is there any way to give threads to different cores by pthreads?
...
If a model changes an attribute locally, then changes it back, ActiveRecord doesn't send the change to the DB. This is great for performance, but if something else changes the database, and I want to revert it to the original value, the change doesn't take:
model = Model.find(1)
model.update_attribute(:a, 1) # start it off at 1
# some ...
I have a class that serves as a delegate to another.
public class Delegate {
private AnotherClass ac;
public void delegateCall() {
this.ac.actualCall();
}
public void setAC(AnotherClass ac) {
this.ac = ac;
}
}
What are the ramifications if I have lots of threads calling delegateCall() and another...
Hi,
I have multiple threads each one with its own private concurrent queue and all they do is run an infinite loop retrieving messages from it. It could happen that one of the queues doesn't receive messages for a period of time (maybe a couple seconds), and also they could come in big bursts and fast processing is necessary.
I would l...
Hi, I'd like to begin thinking about how I can scale up my algorithms that I write for data analysis so that they can be applied to arbitrarily large sets of data. I wonder what are the relevant concepts (threads, concurrency, immutable data structures, recursion) and tools (Hadoop/MapReduce, Terracota, and Eucalyptus) to make this happe...
Under JBoss 4.0.1SP1, I have a servlet that makes multiple, concurrent calls to web services that are running under the same instance. I'm using request.getServerName() (on HttpServletRequest) to construct the endpoint URL. This normally works fine, but every once in a while returns null.
I hadn't seen this before running the web servic...
I have an application that every 15 minutes or so does a replication from a remote database. It just keeps the two repositories in sync. Once this replication is going it is not possible to do it again. I have setup the following structure but I'm not sure if it is the correct approach.
public class ReplicatorRunner {
private...
I have a NamedPipeClientStream instance in my application that is setup for duplex communication (PipeDirection.InOut). I also have two threads, a read thread and a write thread.
I want to have the read thread call only the NamedPipeClientStream.Read method, and the write thread only call the NamedPipeClientStream.Write method. They w...