Here is an interesting analysis of a race condition -
http://mailinator.blogspot.com/2009/06/beautiful-race-condition.htmlThejo
On Tue, Sep 1, 2009 at 9:00 AM,
<concurrency-interest-request@...> wrote:
Send Concurrency-interest mailing list submissions to
concurrency-interest@...
To subscribe or unsubscribe via the World Wide Web, visit
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
or, via email, send a message with subject or body 'help' to
concurrency-interest-request@...
You can reach the person managing the list at
concurrency-interest-owner@...
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Concurrency-interest digest..."
Today's Topics:
1. Re: Concurrent Puts on HashMap on different key sets. (James Gan)
---------- Forwarded message ----------
From: James Gan <ganzhi@...>
To: Elias Ross <genman@...>
Date: Tue, 1 Sep 2009 08:31:48 +0800
Subject: Re: [concurrency-interest] Concurrent Puts on HashMap on different key sets.
The worst thing in my mind is data race. If it happens, your customer might get wrong result without any prompt. It takes days to find such kind of bugs without an adequate tool.
On Sat, Aug 29, 2009 at 1:57 AM, Elias Ross
<genman@...> wrote:
On Fri, Aug 28, 2009 at 7:07 AM, Tim Peierls
<tim@...> wrote:
No, you cannot. HashMap is not at all thread-safe. Examples of what might go wrong, not in any way exhaustive: Two keys from different key sets might hash to the same bucket, or the bucket array might be resized in one thread while you're putting a value in another.
I have also experienced one thread hanging in an infinite loop on a put. An infinite loop is probably the worst possible thing to happen to your application, as it not only hangs one thread but it will use most of the CPU resources.
java.util.Hashtable is not safe to iterate over without locking. A college said that it was, since you won't see ConcurrentModificationException thrown from the Enumerator when iterating over the keys and values, but I can't imagine that it is.
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
--
Best Regards
James Gan
Current Project: Concurrent Building Block at http://amino-cbbs.sourceforge.net/
Blog: http://ganzhi.blogspot.com
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@...
http://cs.oswego.edu/mailman/listinfo/concurrency-interest