lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Engels" <reng...@ix.netcom.com>
Subject RE: Multiple threads searching in Lucene and the synchronized issue. -- solution attached.
Date Wed, 10 May 2006 15:26:07 GMT
You are correct.

It would seem that modern processor architecture will provide a better
solution to this. Since they seem to be giving up on clock-speed and going
with multiple parallel cores, and multi-processors, making a solution to
this problem of even greater importance. The upside should be that JVMs will
be able to implement synchronized more efficiently.


-----Original Message-----
From: Yonik Seeley [mailto:yseeley@gmail.com]
Sent: Wednesday, May 10, 2006 10:07 AM
To: java-dev@lucene.apache.org; rengels@ix.netcom.com
Subject: Re: Multiple threads searching in Lucene and the synchronized
issue. -- solution attached.


On 5/10/06, Robert Engels <rengels@ix.netcom.com> wrote:
> I think you could use a volatile primitive boolean to control whether or
not
> the index needs to be read, and also mark the index data volatile and it
> SHOULD PROBABLY work.

No, that still doesn't work.
volatile doesn't quite mean what you think it means with the Java
memory model < v1.5.

Reads and writes of volatile variables may not be reordered, *but*
non-volatile reads & writes may still be reordered w/ respect to the
volatile ones (making volatile not-that-useful).

The *reference* to the object is really the only thing that becomes
consistent across threads... the fields of objects the reference
points to can be inconsistent unless all the fields are volatile.

The memory model changed in Java1.5, and the meaning of volatile along with
it.

-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message