[concurrency-interest] j.u.c/backport performance on Windows

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Sun Apr 1 20:25:36 EDT 2007


On 01/04/07, Peter Kovacs <peter.kovacs.1.0rc at gmail.com> wrote:

> In more concrete terms: you can find the problematic backport-based
> implementation here:
> http://www.chemaxon.com/shared/pkovacs/concurrent/processors/InputOrderedWorkUnitProcessor.java
> . "outputQueue" is the variable where I am using LinkedBlockingQueue.
> And yes, my case falls into the multiple-producer-one-consumer
> category.

Now I think I can see your problem. You are using a proper bounded
buffer implementation (LinkedBlockingQueue) but you short-cut or
re-implement the synchronization of it. Try to refactor your program
so that:

- use the synchronized put method of the LinkedBlockingQueue instead of
  the polling offer method

- drop the extra handshake via the lock inputProducerLock

- make the producer create an item first and then call the put method with
  the prepared item

I believe this helps with the performance difference as well.

Best Regards,
Szabolcs


More information about the Concurrency-interest mailing list