concurrency

Concurrent access to WCF client proxy

Hi, I'm currently playing around a little with WCF, during this I stepped on a question where I'm not sure if I'm on the right track. Let's assume a simple setup that looks like this: client -> service1 -> service2. The communication is tcp-based. So where I'm not sure is, if it makes sense that the service1 caches the client proxy fo...

php & ruby scripts accessing the same db and table can cause corruption ?

i have a php file which regularly writes and reads tables from mysql DB. i have another ruby file that runs at the same time which reads and write to the same tables in mysql DB. can there be potential issues with this set up ? ...

difficult syncronization problem with FLEX commands (in cairngorm)

My problem, simplified: I have a dataGrid with a dataProvider "documents" A column of the datagrid has a labelFunction that gets the project_id field of the document, and returns the project name, from a bindable variable "projects" Now, I dispatch the events to download from the server the documents and the projects, but If the documen...

How to model concurrency in unit tests?

I'm pretty new to unit testing and currently experimenting a bit with Visual Studio's testing tools. My question is how to define assertions about concurrent behaviour in these tests. E.g. given a class BoundedChan<T> implementing a bounded channel, how can I specify tests like "channel.Send will not block" or "If the channel's capac...

FLEX Cairngorm commands... odd behaviour

while trying to solve my problems in serializing the execution of cairngorm commands, I tried to bypass completely the event dispatching and simply instantiated the command I wanted to execute, then called it's execute method. In this method there's a call to a delegate that calls ServiceUtils that performs the HTTPService.send thing... ...

Advice for efficient blocking queries

I would like to store tuples objects in a concurent java collection and then have an efficient, blocking query method that returns the first element matching a pattern. If no such element is available, it would block until such element is present. For instance if I have a class: public class Pair { public final String first; public...

Python UDP socket options for multiple & concurrent clients

Hi all. Let me explain a bit the app i'm doing. I'm creating a central UDP (needs to be UDP) server for multiple and concurrent clients that also "talk" between them. I do a check into a dict of known clients addresses and create a client handler thread if "i dont know" the client. Else, the thread receives the data ad does its job. Th...

Unit Testing Concurrent Code

My weekend project consists of writing a cross-platform concurrency primitives library (critical sections, read/write mutexes, interlocked integers, events, etc) and was wondering how to unit test this stuff. I realize that testing concurrent code is hard in itself, but testing the primitives of said code couldn't be that hard, could it?...

Concurrent system modeling tools

I'm currently taking a course in concurrent software design, and we're focusing a lot on modeling. I see the value in this, but I am not sure if the tool we are using is horrible, good, or somewhere in between, because I can't find any other examples. We're currently using LTS Analyzer, with some more information here. So my questio...

Is this a safe version of double-checked locking?

Here's an idea I just came up with for a safe, efficient way of handling Singleton synchronization issues. It's basically double-checked locking, but with a twist that involves thread-local storage. In Java/C#/D-style pseudocode, assuming __thread denotes thread-local storage for static variables: class MySingleton { __thread stat...

Thread-local, class instance-local storage?

Is there a good, platform-agnostic way to implement a variable that's local to both a thread and a class instance, i.e. if you have T threads and I class instances, you have TxI instances of that variable? I'm using the D programming language, version 2, but a good language-agnostic answer would also be useful. Here are some constraint...

Literature/documentation on two cooperating processes using a flag for lock-free shared memory

Is there any other documentation/discussion about the following design pattern (I'm not sure what it is called) from a well-known source? I'm almost 100% sure that the following will manage data safely between two (not more than two) processes, but would feel much better if I could find some more detailed information on why it works from...

scala actors: long running io operations

Hi! I have quite some trouble with actors which contain long running operations, in my case persistent socket connections. Here is some test code which runs fine if I create less than four Server instances, but if I create more instances, I always end up with only three or sometimes four concurrent socket connections, because the other o...

Strategies for concurrent pipelines in Java

Consider the following shell script: gzip -dc in.gz | sed -e 's/@/_at_/g' | gzip -c > out.gz This has three processes working in parallel to decompress a stream, modify it, and re-compress it. Running time I can see my user time is about twice that of my real time, which indicates the program is effectively working in parallel. I'...

Implementing a cache using a java ConcurrentHashMap

Hello, I'd like to implement a simple caching of heavyweight objects in a web java application. But I can't figure out how to do it properly. Am I missing something or ConcurrentHashMap methods (putIfAbsent, ...) are not enough and additional synchronization is needed ? Is there a better simple API (In memory storage, no external confi...

Log4j DailyRollingFileAppender concurrency with multiple processes

I have a number of identical processes that are writing to a single log file using a Log4j DailyRollingFileAppender. I am concerned that multiple processes may try and roll the file and that chaos will ensue. Does the implementation allow for this using with some kind of locking mechanism? - the Javadoc doesn't mention it. ...

Suitable collection class for event listeners in Java

Related: http://stackoverflow.com/questions/1391918/does-java-have-a-linkedconcurrenthashmap-data-structure I am looking for a collection class to hold references to event listeners. Ideally I would like the collection to have the following properties (in order of priority): Maintains insertion order. The earlier listeners may can...

Why doesn't my threaded .Net app scale linearly when allocating large amounts of memory?

I’ve run into something strange about the effect of large memory allocations on the scalability of the .Net runtime. In my test application I create lots of strings in a tight loop for a fixed number of cycles and spit out a rate of loop iterations per second. The weirdness comes in when I run this loop in several threads – it appears th...

what is the best way to synchronize container access between multiple threads in real-time application

Hi, I have std::list<Info> infoList in my application that is shared between two threads. These 2 threads are accessing this list as follows: Thread 1: uses push_back(), pop_front() or clear() on the list (Depending on the situation) Thread 2: uses an iterator to iterate through the items in the list and do some actions. Thread 2 is i...

Ajax concurrency

I have a web application where there is a timer that is constantly counting down. Meanwhile, the client frequently checks with the server to see if more time has been added to the timer. The code looks something like this: function tick() { // This function is called once every second time -= 1; redisplay(time); }; function ...