JavaMemoryModel: Is reordering of dependent reads on Alpha actually possible?

From: Jeremy Manson (
Date: Fri Feb 25 2000 - 13:24:51 EST


My name is Jeremy Manson. The fact that the Alpha specification allows
aggressive reorderings has caused of lot of discussion and worry about
things like seeing garbage value in fields if objects aren't allocated
out of pre-zeroed member, and seeing incorrect null values in final
fields and virtual method pointers. We are trying to figure out if this
can happen in real life.

The Alpha specification allows the following sequence of events:

initially, X = 1 and Y = 1

Thread 1 Thread 2
write 2 to X Read 2 from Y
memory barrier Read 1 from X
write 2 to Y

This kind of reordering obviously makes it very difficult to implement
objects safely and with speed on an Alpha SMP (without memory barriers
in both the reader and writer).

We have written a short program to try to duplicate such a result, and
run it on an AlphaServer 2100/A (this runs 4 21064A processors). This
program is available at

We tried it with both dependent and independent reads, and we have seen
no results which would indicate that this read of a stale cache value /
instruction reordering is occurring. Does anyone know of or have access
to a SMP Alpha that might encounter these difficulties?

As a post script, we also tried this on an Intel (Dual Pentium II / 350)
and did not come across any errors. The Pentium specification seems to
suggest this is possible... does anyone have any better information?

Many thanks,


JavaMemoryModel mailing list -

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