concurrency

How to maintain a pool of names ?

I need to maintain a list of userids (proxy accounts) which will be dished out to multithreaded clients. Basically the clients will use the userids to perform actions; but for this question, it is not important what these actions are. When a client gets hold of a userid, it is not available to other clients until the action is completed....

Limiting the maximum number of concurrent requests django/apache

Hi, I have a django site that demonstrates the usage of a tool. One of my views takes a file as input and runs some fairly heavy computation trough an external python script and returns some output to the user. The tool runs fast enough to return the output in the same request though. I would however want to limit how many concurrent re...

Can I get the stack traces of all threads in my c# app?

I'm debugging an apparent concurrency issue in a largish app that I hack on at work. The bug in question only manifests on certain lower-performance machines after running for many (12+) hours, and I have never reproduced it in the debugger. Because of this, my debugging tools are basically limited to analyzing log files. C# makes it ...

iPhone: NSOperationQueue running operations serially

I have a singleton NSOperationQueue that handles all of my network requests. I'm noticing, however, that when I have one particularly long operation running (this particular operation takes at least 25 seconds), my other operations don't run until it completes. maxConcurrentOperationCount is set to NSOperationQueueDefaultMaxConcurrentOp...

Why do condition variables sometimes erroneously wake up?

I've known for eons that the way you use a condition variable is lock while not task_done wait on condition variable unlock Because sometimes condition variables will spontaneously wake. But I've never understood why that's the case. In the past I've read it's expensive to make a condition variable that doesn't have that behavior,...

Java - Multithreading

What is the difference between synchronized methods and synchronized statements ? If possible , please use an example to make it more clear. Thanks. ...

Is there an implementation of rapid concurrent syntactical sugar in scala? eg. map-reduce

Passing messages around with actors is great. But I would like to have even easier code. Examples (Pseudo-code) val splicedList:List[List[Int]]=biglist.partition(100) val sum:Int=ActorPool.numberOfActors(5).getAllResults(splicedList,foldLeft(_+_)) where spliceIntoParts turns one big list into 100 small lists the numberofactors part, ...

LAN inter-process communication in C#?

What's the easiest way to implement lan interprocess communication? I need process on machine A be blocked until process on machine B send him just a simple string msg Don't know if it is worth building a whole WCF project. What Do you say? ...

ASP.Net Architecture Specific to Shared/Static functions

Hello All, Could someone please advise in the context of a ASP.Net application is a shared/static function common to all users? If for example you have a function Public shared function GetStockByID(StockID as Guid) as Stock Is that function common to all current users of your application? Or is the shared function only specific ...

How to handle concurrent web requests

I am having a simple webservice running in my local system, hosted in IIS 6.0. This webservice is accessible from any other system (within LAN and Internet) and everything works fine as long as the number of systems accessing my webservice is very much limited. Whereas, if more number of users (say 500) are concurrently trying to acces...

ScheduledThreadPoolExecutor executing a wrong time because of CPU time discrepancy

I'm scheduling a task using a ScheduledThreadPoolExecutor object. I use the following method: public ScheduledFuture<?> schedule(Runnable command, long delay,TimeUnit unit) and set the delay to 30 seconds (delay = 30,000 and unit=TimeUnit.MILLISECONDS). Sometimes my task occurs immediately and other times it takes 70 seconds. I be...

What are the best settings of the H2 database for high concurrency?

There are a lot of settings that can be used in H2 database. AUTO_SERVER, MVCC, LOCK_MODE, FILE_LOCK and MULTI_THREADED. I wonder what combination works best for high concurrency setup e.g. one thread is doing INSERTs and another connection does some UPDATEs and SELECTs? I tried MVCC=TRUE;LOCK_MODE=3lFILE_LOCK=NO but whenever I do some ...

How to write a spinlock without using CAS

Following on from a discussion which got going in the comments of this question. How would one go about writing a Spinlock without CAS operations? As the other question states: The memory ordering model is such that writes will be atomic (if two concurrent threads write a memory location at the same time, the result will be one or the...

Am I correct in my assumption about synchronized block?

I have a method shout() with a synchronized block. private void shout(){ System.out.println("SHOUT " + Thread.currentThread().getName()); synchronized(this){ System.out.println("Synchronized Shout" + Thread.currentThread().getName()); try { Thread.sleep(50); } catch (InterruptedException e) { ...

How to check what the value of app concurrent requests are in IIS

In step 4 of this link there is a description of how to set the maximum concurrent request in IIS throught scripts. Is it possible to see what these values are set to, either through the IIS UI, or in the registry? Note: This is for Windows 2008 and IIS 7 ...

Is there a way to force the JVM to run on a single processor or Core.

In Java, is there a way to force a JVM instance to run on a single CPU/Core. Additionally is there a way for given thread to figure out what CPU it is running on? ...

ConcurrentDictionary updates and enumeration thread sync.

I have 1.N threads writing to a .net 4.0 ConcurrentDictionary. I have another thread which fires every 5 seconds (settable in app.config) to enumerate the dictionary, and potentially remove some items. I want to halt the write operations during the enumeration. What would be the best primitive to synchronize these two operations. Any he...

ExecutorService that interrupts tasks after a timeout

I'm looking for an ExecutorService implementation that can be provided with a timeout. Tasks that are submitted to the ExecutorService are interrupted if they take longer than the timeout to run. Implementing such a beast isn't such a difficult task, but I'm wondering if anybody knows of an existing implementation. Here's what I came up...

size of ConcurrentLinkedQueue

Reading Java's ConcurrentLinkedQueue Docs, I wonder why it is not possible for the implementation to store the size: Beware that, unlike in most collections, the size method is NOT a constant-time operation. Because of the asynchronous nature of these queues, determining the current number of elements requires a traversal of the elem...

LinkedBlockingQueue limit ignored?

I created a Java LinkedBlockingQueue like new LinkedBlockingQueue(1) to limit the size of the queue to 1. However, in my testing, this seems to be ignored and there is often several things in the queue at any given time. Why is this? ...