[Interest] Heavily Commented Example: Simple Single Frontend with Two BackendsHi,

André Somers andre at familiesomers.nl
Wed Oct 24 10:30:38 CEST 2012


Hi,

First of all: thanks for all the insights that many of you'all here have 
shared in this interesting matter. I really learned something here.

Op 24-10-2012 2:19, Thiago Macieira schreef:
> Also note that you should not implement a busy-wait loop like that, 
> like a spinlock. At least on x86, if one CPU is constantly reading 
> from the same address, it will prevent the others from writing to it. 
> Since you're busy- looping, you're spending power. 
I think usually, one would not simply busy-spin doing nothing. That 
indeed would be silly. Rather, it would be used as a cancel flag for an 
ongoing operation that the user might want to interupt. I have used this 
pattern in the past, where for each iteration in the process, I check 
the flag if I need to continue or not. The operation in itself is 
useful, but for whatever reason may need to be cancelled before it 
completes.

André




More information about the Interest mailing list