concurrency

High-level multithreading/concurrency abstractions for .NET

I just wondered why, unlike Scala, F# or Haskell, the basic .NET framework (as available in C# or VB) seems to have very little native support for higher level concurrency patterns. There are basic mechanisms available - locks, monitors, the thread pool - but what about Synchronized variables (MVar) Synchronous channels Asynchronous ...

Concurrent map/foreach in scala

I have an iteration vals: Iterable[T] and a long-running function without any relevant side effects: f: (T => Unit). Right now this is applied to vals in the obvious way: vals.foreach(f) I would like the calls to f to be done concurrently (within reasonable limits). Is there an obvious function somewhere in the Scala base library? Some...

Zend framework concurrency and ajax

I'm developing a web application with zend framework. It is an app for selling movie tickets. The app allows users to select a seat and then buy the ticket. (The problem is similar to the classical air ticket booking.) I have two problems. Problem 1: The page that shows all seats has to refresh with ajax (a seat is green if available a...

LINQ To SQL exception with Attach(): Cannot add an entity with a key that is alredy in use

Consider this typical disconnected scenario: load a Customer object from SQL Server using LINQ To SQL user edits the entity, and the presentation tier sends back the entity modified. the data layer, using L2S, must send the changes to SQL Server Consider this LINQ To SQL query whose intention is to take a Customer entity. Cust cust...

IllegalMonitorStateException raised with explicit lock/condition

I want to have such kind of work flow using explicit lock/condition variables (It's a course project which mandates this style.): A is the main class, it asks B to do some job from time to time. B has a worker class C which constantly queries B about new jobs to do and do it. After C finishes, it will call A's callback function to notify...

How to force multiple commands to execute in same threading timeslice?

I have a C# app that needs to do a hot swap of a data input stream to a new handler class without breaking the data stream. To do this, I have to perform multiple steps in a single thread without any other threads (most of all the data recieving thread) to run in between them due to CPU switching. This is a simplified version of the si...

How does one start a thread in Clojure?

I've read a lot about how great Clojure is when it comes to concurrency, but none of the tutorials I've read actually explain how to create a thread. Do you just do (.start (Thread. func)), or is there another way that I've missed? ...

1000 users a day for 10 minutes equal what concurrent load?

Is there a formula that will tell me the max/average # of concurrent users I would expect to have with a population of 1000 users a day using an app for 10 minutes? ...

How to prevent concurrency in web service API?

We have three web services (/a, /b, /c) where each service maps to a method (go()) in a separate Java class (ClassA, ClassB, ClassC). Only one service should run at the same time (ie: /b cannot run while /a is running). However as this is a REST API there is nothing to prevent clients from requesting the services run concurrently. W...

Best way to handle concurrency issues

Hi guys, i have a LAPP (linux, apache, postgresql and php) environment, but the question is pretty the same both on Postgres or Mysql. I have an cms app i developed, that handle clients, documents (estimates, invoices, etc..) and other data, structured in 1 postgres DB with many schemas (one for each our customer using the app); let's a...

Concurrency Issue plotting google maps GeoCoder request on Google Maps Widget

My program has essentially 3 steps: 1) Query Geocoder object for some Coordinates and store them in a Collection 2) Send the results to my main module for plotting on a map 3) Plot them on a google map widget I have created a Requestor class for the purpose of handling the Geocoding -- this class has a getResults() function that returns...

What is the most efficent way to implement concurrency in Python?

In a cluster environment using Python what is the least expensive way to develop a concurrent application or what is the pro / con of the various options? ...

Running xulrunner multiple times concurrently

We have an xulrunner application that is running as a background html to pdf converter. This is essentially a commandline application and shows no user interface. However, xulrunner defaults to trying to share profiles and instances of the application. How can we run multiple instances of the application concurrently without hitting prof...

Concurrent debugging / unit testing alternitive to MS CHESS

I was recently reading a question here (some time this week), which I can't find again ><, where someone was asking about concurrent testing. One of the suggestions was CHESS however I can't use this due to the licence for the VS2008 Pro version being only for academic use, and I don't have Team System. Does anyone know of an alterna...

Deadlocks in concurrent transaction

I am trying to find an algorithm that detects deadlocks in concurrent transactions in a software. I have tried googling but have not found anything. Can someone point be to a good resource to follow on the subject or can someone explain this algorithm? ...

Concurrency: how does shared memory vs message passing handle large data structures?

In looking at Go and Erlang's approach to concurrency, I noticed that they both rely on message passing. This approach obviously alleviates the need for complex locks because there is no shared state. However, consider the case of many clients wanting parallel read-only access to a single large data structure in memory -- like a suffix...

Impossible to make a cached thread pool with a size limit?

It seems to be impossible to make a cached thread pool with a limit to the number of threads that it can create. Here is how static Executors.newCachedThreadPool is implemented in the standard Java library: public static ExecutorService newCachedThreadPool() { return new ThreadPoolExecutor(0, Integer.MAX_VALUE, ...

sqlite only supports 1 transaction?

While using ADO.NET (maybe i am wrong, i dont know what its called) i notice that i can only begin a transaction with a connection and a command seems to have command.Transaction which gets me the transaction data but doesnt start a transaction itself? Actually while looking i see this in System.Data.SQLite // Summary: // The tr...

rails - implementing a simple lock to prevent user's from editing the same data concurrently

Hi - I have an app where I need to prevent users from editing data while it is being edited by a different user. I'm trying to think of the best way to do it and wanted to ask for ideas. So far, I've created a settings model that stores application wide configuration on the db in key/value pairs. So, for the lock, I have a settings insta...

In a BigTable datastore, with regards to concurrency, how do I "lock" an entity?

I am not sure how to handle this in a BigTable datastore. Imagine the following example (just to explain the concept. The example does not match my actual data model): I have a Counter entity that keeps track of the number of Transactions in my dataStore. Let's say the current 'count' is 100. Now two web requests read this value at t...