synchronization in gcj
Godmar Back
gback@cs.utah.edu
Wed Jan 13 12:25:00 GMT 1999
Hi,
I have a question about gcj's use of synchronization.
gcj uses an extra word to store a ptr to the lock associated with an object.
While this speeds up operations such as
a) looking up the lock
b) looking up the lock when entering it recursively
c) looking up the lock when leaving it,
it also introduces the obvious cost of having to waste 4 bytes of
memory for each object, which may be significant.
My question is then: what was your rationale, and have you considered
making the additional storage requirement optional so that users
can decide that space-time trade-off for themselves.
I believe this should be seen in the light of the fact that at least
c) can be optimized without reserving storage with each object, namely
by keeping track of matching lock/unlock pairs.
What do you think?
- Godmar
More information about the Java
mailing list