development efforts on the Solaris side.
Dag-Erling Smørgrav
des at linpro.no
Thu Feb 14 11:48:29 CET 2008
Theo Schlossnagle <theo at omniti.com> writes:
> [re: stv = stevedores = stevedores->next;]
>
> [...] Was worried that the assumption that both assignments were
> atomic. One is, then the next is. Perhaps that doesn't matter. It
> does seem like a hard to trigger race condition to me because while
> the assignment is atomic, the access to stevedores->next is not
> guaranteed to be view consistent in that assignment:
>
> T1: get stevedores->next in R(T1,a)
> T2: get stevedores->next in R(T2,a)
> T1: set stevedores to R(T1,a)
> T2: set stevedores to T(T2,a)
>
> Now T1 and T2 both "advanced the pointer" but they did the same work
> and the stv they have is the same. Is that not a problem? Perhaps
> I don't understand the impact of that scenario correctly.
There is a race, but it's irrelevant. The point of this code is to
spread the load between the stevedores. It doesn't matter if two
simultaneours allocations go to the same stevedore as long as *all*
allocations don't go to the same stevedore. It will balance out in
the long run.
DES
--
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no
More information about the varnish-dev
mailing list