Re: JavaMemoryModel: Threading issues in my connection pool

From: Bill Pugh (pugh@cs.umd.edu)
Date: Wed Sep 06 2000 - 10:03:56 EDT


At 10:53 AM -0400 9/1/00, David W. Smiley wrote:
> I just started following the issues related to the JMM at Bill's
>site. I think that the problems with the JMM are very bad and their
>resolve is very important to the advancement of Java. I am currently
>building a JDBC connection pool implementation. It is complex in terms
>of its multithreaded nature. There are a few techniques I am using to
>avoid synchronization:
> double-check idiom
> copy on write
> no sync on read, sync on write --flags (ints/booleans used for state)

It would be very interesting for me to find out what the cost of just
doing standard synchronization is. A lot of times, I think people
jump to using tricks to try to avoid synchronization, when
synchronization cost isn't a noticeable issue for their application.
We need to identify those applications where synchronization cost is
high, so that we can make sure we address the issues raised by those
applications in any revisions to the memory model.

As far as the situation right now, the existing memory model is too
weak, and many JVM's ignore most or all of the important properties
of volatile. So the only technique I have any confidence in requires
that threads synchronize every time they wish to communicate with
another thread. In practice, the problems probably only show up in a
few JVM's. But that isn't much help if you are trying to write code
that runs correctly everywhere.

        Bill
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:27 EDT