[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Should Caches be global or Fluid?



Michael & I noticed some class variables in BertCrum used as caches
for speeding up some operations.  Michael pointed out that under
multiple threading we'd get bad cache behavior and difficult to debug
interactions.  He suggests that caches might be constrained to hold at
least the most recently cached item of each thread.  This guarantees
non-starvation in the case where a thread is counting on a cache hit
to make progress.  This is obviously a postponable issue, as such
caches should be easily upwards compatable with our current code.
Just thought we'd mention it.

However, the specific use of class variables as caches in BertCrum is
incompatable with multi-threading, as "CachedBertCrum" and
"CachedBertPath" are assumed to be consistent with each other despite
lack of mutual exclusion to assure this.  A perfectly adequate
solution would be to use Fluid Variables for these.