declare Sum S={NewCellT 0}
fun {Sum}
{Trans proc {$ T _} {T.assign S 0} end _ _}
for J in 0..80;20 do
{Trans
proc {$ T _}
for I in J+1..J+20 do
{T.assign S {T.access S}+{T.access D.I}} end
end _ _}
end
{Trans fun {$ T} {T.access S} end _}
end
Sunday, March 22, 2009
Ch8, Ex10
The reason that sum is locking all the cells is that its calculating the whole sum in one big transaction and in the growing phase of this transaction it locks all the cells and keep them all locked unless whole sum is calculated. So, the strategy is to simply break the calculation of full sum into partial sums. Here is the code..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment