On Sun, 30 Sep 2007 17:08:04 -0700 (PDT) Mohammad M Molla <merajul_i@xxxxxxxxx> wrote: > Hi > > Inside the kernel, I see in many places xchg is used to swap two > pointers atomically? What is the difference between exchanging using > xchg and getting lock, then exchange, then unlock? Is it only > performance reason? Spinlocks on x86 are actually implemented using xchg, so you cannot really escape them :) -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ