Re: [perf-discuss] Re: Is the following CAS(Compare and Swap ) function preserves atomicity?

2006-03-22 Thread Dan Price
On Wed 22 Mar 2006 at 07:32PM, Rama Krishna wrote: > In our solaris system atomic_cas( ) is not available in user > space,to make it available we require to download some of the > patches. So we are making use of our own atomic primitive. Base on > your guidance we are trying to modify our

[perf-discuss] Re: Is the following CAS(Compare and Swap ) function preserves atomicity?

2006-03-22 Thread Rama Krishna
In our solaris system atomic_cas( ) is not available in user space,to make it available we require to download some of the patches. So we are making use of our own atomic primitive. Base on your guidance we are trying to modify our primitive to make use of CMPXCHG instruction. As atomic

Re: [perf-discuss] Is the following CAS(Compare and Swap ) function preserves atomicity?

2006-03-22 Thread Jonathan Adams
On Wed, Mar 22, 2006 at 07:10:28PM +0100, Michael Schulte wrote: > You should find out the "atomic" native assembler instruction > on your system that does a "cas" and try to use this for your purpose. > Otherwise you will always have races in your code. Well, the code below does, in fact, use an

Re: [perf-discuss] Is the following CAS(Compare and Swap ) function preserves atomicity?

2006-03-22 Thread Michael Schulte
You should find out the "atomic" native assembler instruction on your system that does a "cas" and try to use this for your purpose. Otherwise you will always have races in your code. Best regards, Michael Rama Krishna wrote: Hi, Below is the atomic function of compare and swap instruction (CA

Re: [perf-discuss] Is the following CAS(Compare and Swap ) function preserves atomicity?

2006-03-22 Thread Roch Bourbonnais - Performance Engineering
I'm no expert but if you don't have a memory operation somewhere I doubt you will succeed. I see "The first which entering the code only the value of 0 in the carry flag" are you trying to have a CAS that works only on single-cpu systems ? Have you identified a problem with the