concurrency

Platform independent file locking?

I'm running a very computationally intensive scientific job that spits out results every now and then. The job is basically to just simulate the same thing a whole bunch of times, so it's divided among several computers, which use different OSes. I'd like to direct the output from all these instances to the same file, since all the com...

Synchronizing on shared data structure

Consider code that involves multiple threads writing to a shared data structure. Now each of these threads write objects to the shared container that are essentially unique. Take the following (fictitious) example: class Logger { IDictionary<string, Log> logDictionary = new Dictionary<string, Log>(); // Method called by several o...

design of a Producer/Consumer app

I have a producer app that generates an index (stores it in some in-memory tree data structure). And a consumer app will use the index to search for partial matches. I don't want the consumer UI to have to block (e.g. via some progress bar) while the producer is indexing the data. Basically if the user wishes to use the partial index, i...

Is there a way for multiple processes to share a listening socket?

In socket programming, you create a listening socket and then for each client that connects, you get a normal stream socket that you can use to handle the client's request. The OS manages the queue of incoming connections behind the scenes. Two processes cannot bind to the same port at the same time - by default, anyway. I'm wondering ...

Business application - pessimistic concurrency using messaging

We are using messaging in a project of ours to implement pessimistic concurrency. This means that if messaging goes down (channel goes down), concurrency goes down. Is this done in other business applications? Do you close the application (log out the user) if messaging goes down? I'm thinking more of combining the optimistic and p...

What are some hints that an algorithm should parallelized?

My experience thus far has shown me that even with multi-core processors, parallelizing an algorithm won't always speed it up noticably. In fact, sometimes it can slow things down. What are some good hints that an algorithm can be sped up significantly by being parallelized? (Of course given the caveats with premature optimization...

How to "share state" with Erlang Style Concurrency?

Erlang works with message passing between actors as it's concurrency model. Assume I have 3 actors who sell items. The total number of items is 7. How do they excactly sell 7 items? How do they coordinate themselves? We could have one actor with the number of available items, acting on "buy" messages (inventory actor). This would be a S...

Threads in Flash and Flex

Are threads possible in Flash, Actionscript and Flex just like in C# and Java? ...

How can I guarantee a "stay alive" heartbeat is sent?

We have an RMI client application written in Java which needs to send periodic "stay alive" messages to a server application. We have implemented this as a separate heartbeat thread, which sends the stay alive message to the server, then sleeps for 15 seconds using Thread.sleep(). The thread is set to be high priority: Thread heartbeat...

Restricting a SELECT statement in SQL Server 2005

Hi, I have a situation where before doing a particular task I have to check whether a particular flag is set in DB and if it is not set then rest of the processing is done and the same flag is set. Now, in case of concurrent access from 2 different transactions, if first transaction check the flag and being not set it proceeds further. ...

Concurrency ASP.NET best-practises worst-practises

In which cases to you need to watch out for Concurrency problems (and use lock for instance) in ASP.NET? Are there 'best practises' around on this topic Documentation? Examples? 'worst practises...' or things you've seen that can cause a disaster...? I'm curious about for instance singletons (even though they are considered bad prac...

Static Function Concurrency ASP.NET

If you have two threads invoking a static function at the same moment in time, is there a concurrency risk? And if that function uses a static member of the class, is there even a bigger problem? Are the two calls seperated from each other? (the function is like copied for the two threads?) Are they automatically queued? For instance...

MySQL - Concurrent SELECTS - one client waits for another?

Hi, I have the following scenario: I have a database with a particular MyISAM table of about 4 million rows. I use stored procedures (MySQL Version 5.1) and one in particular to search through these rows on various criteria. This table has several indexes on it, and the queries through this stored procedure are normally very fast ( <1s...

PFX ConcurrentQueue - is there a way to remove a specific item from the queue

I have an app that has a ConcurrentQueue of items that have an ID property and a ConcurrentQueue of tasks for each item, the queue items look like: class QueueItem { public int ID { get; set; } public ConcurrentQueue<WorkItem> workItemQueue { get; set; } } and the queue itself looks like: ConcurrentQueue<QueueItem> itemQueue; I...

Why does WCF limit concurrent connections to 5?

I have a WCF service (basicHttpBinding) hosted in II7 on Vista that I expect to handle many requests concurrently. I'm attempting to load test the service by spawing 200 threads in a test app and calling the WCF service. I've run this test app on the same machine as the server as well as multiple other computers and I always get the sa...

Java ConcurentMap keySet() question when map is modified and iterating over keyset.

Quick background I have a concurrent map I used to cache some values that change quite often (still worth caching them from testing). I want to evict items from my cache at regular intervals by examining an expire time in the value. I am using the keySet() method to get a reference to all my keys and then check the values and if expired ...

Do I need to worry about concurrency with tomcat spring beans?

Not quite understanding enough about java, do I need to worry about concurancy issues when listing, and changing DTO objects in my spring java beans in a single server tomcat application? ...

Tool for detecting concurrency problems

I saw a tool which can tell you if you have design problem in your project and I'm wondering if there is a tool which can tell you dynamically if there are some concurrency problems in your project. ...

AtomicIntegerArray vs AtomicInteger[]

Is there any difference in meaning of AtomicIntegerArray and AtomicInteger[]? And which one is faster to use? (only thing that I noticed is that first is taking much less space, but that means that each recheck is checking boundaries of array, so that would make it slower?) Edit: In a scenario where array is pre-initialized. ...

MS Access (MDB) concurrency

For a small project I need to utilize a simple database with very light requirements: few tables, no more than few thousands of records in total, 2 or 3 users. I am working in .NET environment. As a database server (even those Express editions) seems like a huge overkill in this case, a very simple MDB database could do for most of the ...