concurrency

How to control Javascript threading and redrawing in IE7

Hi there, I've got a sequence of Javascript function calls in a function I have defined to be executed when a web doc is ready. I expected them to be executed in sequence, as one ends the next begins, but the behaviour I see doesn't match up with that. Additionally there is manipulation of the graphical components going on in between t...

Java Concurrency Exercises

Does anybody have suggestions for good resources and exercises on Java concurrency, particularly the new Java 5 constructs? They should have model answers ideally. I also found the following a number of good examples in State Models and Concurrency (Magee): http://www.doc.ic.ac.uk/~jnm/book/ ...

java object serialization - thread safe ?

Hi, I am writing highly concurrent application, which is extensively modifies objects of MyClass. The class is composed of several fields. My question is how to prevent modifications of particular object during its serialization by another thread? Regards, Matt ...

Why is using replicate much slower than serial execution?

Hi, I've got a bit of a problem. I wanted to use scala.concurrent.ops.replicate to parallelize my program. But I found out, that the algorithm actually becomes much slower. So I wrote a little test and still got the same result. So here they are. Serial Code: Takes about 63 seconds to finish object SerTest { def main(args: Array[Stri...

JMS onMessage() and concurrency ....

I have a stand-alone JMS app that subscribes to several different JMS topics. Each topic has its own session and onMessage() listener. Each onMessage() method updates a common current value table - all the onMessage() methods update the same current value table. I've read that the onMessage method is actually called on the JMS provider'...

How to remove old queued tasks in ThreadPoolExecutor and insert new tasks instead?

I load a lot of images form internet with a ThreadPoolExecutor. When new images found, I need to render it first, in that case I want to abandon the old tasks which are still queued in the ThreadPoolExecutor and added these new items to download. I found there are no "clear queue" method in ThreadPoolExecutor, and "purge" method sounds...

SQL Server transactions / concurrency confusion - must you always use table hints?

When you create a SQL Server transaction, what gets locked if you do not specify a table hint? In order to lock something, must you always use a table hint? Can you lock rows/tables outside of transactions (i.e. in ordinary queries)? I understand the concept of locking and why you'd want to use it, I'm just not sure about how to implemen...

Concurrent programming techniques, pros, cons

There is at least three well-known approaches for creating concurrent applications: Multithreading and memory synchronization through locking(.NET, Java). Software Transactional Memory (link text) is another approach to synchronization. Asynchronous message passing (Erlang). I would like to learn if there are other approaches and dis...

Erlang style concurrency in the D programming language.

I think Erlang-style concurrency is the answer to exponential growth of core count. You can kind of fake it with other main stream languages. But the solutions always leave me wanting. I am not willing to give up multi-paradigm programming (C++/D) to switch to Erlang's draconian syntax. What is Erlang-style concurrency: From one of ...

How to implement concurrency primitives?

Where can I find information (books, papers, tutorials) on how concurrency primitives are usually implemented? I'm mostly interested in the implementation of inter-process communication, or message-passing (both synchronous and asynchronous): send, receive, select etc. ...

Ruby concurrency/asynchronous processing (with simple use case)

I was looking into ruby's parallel/asynchronous processing capabilities and read many articles and blog posts. I looked through EventMachine, Fibers, Revactor, Reia, etc, etc. Unfortunately, I wasn't able to find a simple, effective (and non-IO-blocking) solution for this very simple use case: File.open('somelogfile.txt') do |file| wh...

Does master/worker scale?

I have a master/worker model implemented with separate python processes. The master process holds job/result lists which are protected by mutexes. Many workers run on many machines (about 200 worker processes). I have noticed that on each machine the workers tend to do 0-20% more or less work than other worker processes and that the mac...

Concurrent Priority Queue in .NET 4.0

It seems there are lots of improvements in .NET 4.0 related to concurrency that might rely on concurrent priority queues. Is there decent priority queue implementation inside framework available for reuse? ...

How would I make a thread join on another thread but only wait for n seconds of CPU time?

otherThread.join( time ) appears to wait time in real milliseconds. I want to wait time in actual CPU time so that I can get consistent behavior within my application. I've done a quick look at ThreadMXBean but that doesn't quite seem to have what I wanted ( it tells me the threads actual CPU time, but offers no convenient way to wait ...

Can't safely lock a value of a ConcurrentDictionary

Hi, I'm having trouble locking on an item within a Collection - specifically a ConcurrentDictionary. I need to accept a message, look up that message within the Dictionary and then run a lengthy scan on that. As the program takes a lot of memory, after the scan the objects return true if they think its a good time to delete it (which I...

Benefits of public modifier on Java Thread's run()

Does anyone have any insight into the history of Java Thread class's run() method being public? Almost all the time, it gets used by overriding and thus would the protected modifier have been more appropriate? That would still leave the start() as the public api for users and thus not leave any room for mistakes with users calling run() ...

Junit to test concurrency

Hi, I'm trying to test java.util.concurrent.ConcurrentLinkedQueue when accessed via multiple threads. Mentioned below is my Junit test using RepeatedTest to run in two concurrent threads. My questions is: is it correct to use RepeatedTest to test concurrency for example on ConcurrentLinkedQueue? The source code is mentioned below. Than...

Cross thread access problem in ResponseCallback in Windows Phone 7

Basically, I'm getting some data from a WebService, and in the ResponseCallback I'm trying to fill an ObservableCollection with the results I got from the response, but I get an UnauthorizedAccessException "Invalid cross-thread access" when I try to do so. What would be the best way to fill said observable collection when I get the resu...

Is it thread-safe to store data inside a static field when deploying on Google App Engine?

I was browsing through the code of Vosao CMS, an open source CMS hosted on Google App Engine (which I think is an awesome idea), and I stumbled upon the following code inside the CurrentUser class: /** * Current user session value cache class. Due to GAE single-threaded nature * we can cache currently logged in user in static property...

Lock-free implementation of a Thread Library

I have been going through a few published papers which details algorithms and data structures which can be used for implementation of a thread library. I searched online to view any existing implementation of the same, and I could only find LFThreads(only its documentation, not its source code). Have any of you worked on/used a lock-fre...