JavaMemoryModel: Another software-only solution

From: Bill Pugh (
Date: Thu Jul 01 1999 - 08:03:39 EDT

If we assume that this reordering might happen due to stale cache
lines, rather than value prediction, here is a solution. In the
nursery, always allocate objects starting at the beginning of a new
cache line.

That way, no other processor will have cached the memory that another
processor allocates an object in. This will handle both the
implementation issues (making sure virtual method dispatch doesn't
crash the machine) and provide initialization safety.

Now, of course this wastes some space, but only in the nursery. When
the garbage collector moves objects out of the nursery, it can store
them compactly.

There is a general assumption that garbage collection is a global,
stop-the-world action (although perhaps brief), and that all
processors do a memory barrier before and after the garbage
collection. If that isn't true, you have another whole set of issues
to deal with.

Of course, to make this work according to the architecture
specification, the processor memory model will need to take cache
lines into account. Yuck.

This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email
To send a request to the list, email and put
your request in the body of the message (use the request "help" for help).
For more information, visit

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