concurrency

managing collections in memcached

I'm wondering about managing collections of data in memcached. I'm confused about how I maintain cache freshness/integrity when I have many levels of caching at work. Let's assume I have a hierarchy of cached data objects, for example, A represents the most atomic element of data, B represents a collection of 10 As C represents ...

How can I handle multiple messages concurrently from a JMS topic (not queue) with java and spring 3.0?

Note that I'd like multiple message listeners to handle successive messages from the topic concurrently. In addition I'd like each message listener to operate transactionally so that a processing failure in a given message listener would result in that listener's message remaining on the topic. The spring DefaultMessageListenerContaine...

Is it rude to trigger OnNext from different threads in Reactive Extensions (Rx)?

When implementing IObserver yourself, you know how well you would cope with a situation where OnNext is invoked from different threads, concurrently or sequentially, but what are the expectations of the built in Reactive Extension primitives when it comes to this? Will BufferWithTime, for example, cope with OnNext being invoked from mult...

Why doesn't this thread example work? It all wait()'s

The code below is to emulate a robotics simulator I'm working with. I'm not entirely sure why this doesn't work - I'm not very familiar with threads and even though I've tried reading plenty today, I don't seem to be making progress. The problem is that once pauseDistanceSensor() is called, it never wakes up. import java.util.Random; p...

Implementing order in a PHP/MySQL CMS & dealing with concurrency.

I have the following tables: ======================= ======================= | galleries | | images | |---------------------| |---------------------| | PK | gallery_id |<--\ | PK | image_id | | | name | \ | | title | | | description ...

Difference between synchronization of field reads and volatile

In a nice article with some concurrency tips, an example was optimized to the following lines: double getBalance() { Account acct = verify(name, password); synchronized(acct) { return acct.balance; } } If I understand that correctly, the point of the synchronization is to ensure that the value of acct.balance that are read by ...

Wait for an Actor to exit()

How do I wait for a Scala Actor to exit()? I set up two Actors in a unit test, and send a few messages to get them started. They send a few messages back and forth and eventually both call exit(). How do I make my unit test wait for both Actors to finish up before passing? ...

Insert Concurrency Issue - Multithreaded Environment

I have an issue that the same stored procedure is being invoked at exactly the same time with exactly the same paramenters. The purpose of the stored procedure is to fetch a record if it exists or to create and fetch the record if it does not exist. The problem is that both threads are checking the existence of the record and reporting...

what the difference between a lock and a latch in the context of concurrent access to a database

I am trying to understand a paper on concurrent B-tree, in which the author mentioned latch vs lock, and how latches do not need a "Lock Manager". I have been trying to figure out what are differences between those two for two days. Google resulting in: "locks assure logical consistency of data. They are implemented via a lock table, ...

Hibernate 2nd level cache ObjectNotFoundException with a high number of concurrent transactions

We have a Java application that uses MySQL, Hibernate (3.5.1-Final) and EHcache(1.2.3) for our 2nd level cache. Our hibernate.properties isolation level is Read-committed isolation = 2 # 2-Read committed isolation hibernate.connection.isolation=2 Under a high number of concurrent transactions, we're seeing an issue where certain col...

Thread Safing "Select" Linq Queries?

I understand how editing rows can cause concurrency issues, but concurrency issues being caused by selecting rows is something I do not understand. If a query selects data from a database, how can a concurrency issue arise? Is it if there is a change made to the data I'm selecting, things will blow up? In any case, if there is a con...

Concurrency in django admin change view

My model: class Order(models.Model): property_a = models.CharField() property_b = models.CharField() property_c = models.CharField() Many users will access a given record in a short time frame via admin change page, so I am having concurrency issues: User 1 and 2 open the change page at the same time. Assume all values a...

Concurrent Set Queue

Maybe this is a silly question, but I cannot seem to find an obvious answer. I need a concurrent FIFO queue that contains only unique values. Attempting to add a value that already exists in the queue simply ignores that value. Which, if not for the thread safety would be trivial. Is there a data structure in Java or maybe a code snipit...

Python multiprocessing.Queue deadlocks on put and get

I'm having deadlock problems with this piece of code: def _entropy_split_parallel(data_train, answers_train, weights): CPUS = 1 #multiprocessing.cpu_count() NUMBER_TASKS = len(data_train[0]) processes = [] multi_list = zip(data_train, answers_train, weights) task_queue = multiprocessing.Queue() done_queue = mu...

HDF5 write thread concurrency

hi. Is hdf5 able to handle multiple threads on its own, or does it have to be externally synchronized? OpenMP example suggests later. if former, what is the proper way to define dataspace to write? thank you ...

Using volatile long as an atomic

If I have something like this... volatile long something_global = 0; long some_public_func() { return something_global++; } Would it be reasonable to expect this code to not break (race condition) when accessed with multiple threads? If it's not standard, could it still be done as a reasonable assumption about modern compilers? ...

How to make N runnables run for random periods of time, multiple times?

Let's say you have N runnable objects, and for each you want them to execute for random periods of time. Once a runnable object executes for that time period, you want to reschedule it to run for another random period of time. You want to be able to do this for each of the runnables, multiple times. Once a runnable is started, it should...

[Android] MapView ConcurrentModificationException

Hello everyone, As the title suggest i have (sometimes) a concurrentmodificationexception while trying to create a route between two locations ... Here is my code (and in case you're wondering MyOverlay does not try to access the other Overlays in the map) private class fillRouteTask extends AsyncTask<Void, GeoPoint, Void> { /**...

Is there a guarantee that svn automatically merges concurrent "add line" and "delete line" to the same file?

I have a distributed system which uses XML files in an SVN repository as a means of communication (as you may guess from that, communication normally is slow). Some processing nodes add or delete some data to a repository, another processing node takes this as an input event and reacts accordingly. At the moment, everything's fine, but ...

JBoss threads waiting on random monitor

I'm doing some load testing on a web app deployed in JBoss. It starts up fine, but as the test ramps up and more simulated users start hitting JBoss, performance degrades severely: Connecting VisualVM to it, I can see the threads were all fine, then suddenly started spending most of their time waiting for a monitor (green is running, ...