Skip to main content
added 35 characters in body
Source Link

The lock free implementation will be Compare and Swap(CAS) on the counter, inside an indefinite while loop.Let's call it the increment method.The wait free version will have a help method and an announce method.The while loop will run for a fixed number of times, if the CAS does not succeed in these tries, the thread will "announce" for help by writing in it's id to a shared data structure.As soon as thread enters the increment(),it will first "help" all the operations that have been announced. PS:In my implementation,the counter is a structure consisting of integer value, thread id and other information.

The lock free implementation will be Compare and Swap(CAS) on the counter, inside an indefinite while loop.The wait free version will have a help method and an announce method.The while loop will run for a fixed number of times, if the CAS does not succeed in these tries, the thread will "announce" for help by writing in it's id to a shared data structure.As soon as thread enters the increment(),it will first "help" all the operations that have been announced. PS:In my implementation,the counter is a structure consisting of integer value, thread id and other information.

The lock free implementation will be Compare and Swap(CAS) on the counter, inside an indefinite while loop.Let's call it the increment method.The wait free version will have a help method and an announce method.The while loop will run for a fixed number of times, if the CAS does not succeed in these tries, the thread will "announce" for help by writing in it's id to a shared data structure.As soon as thread enters the increment(),it will first "help" all the operations that have been announced. PS:In my implementation,the counter is a structure consisting of integer value, thread id and other information.

Source Link

The lock free implementation will be Compare and Swap(CAS) on the counter, inside an indefinite while loop.The wait free version will have a help method and an announce method.The while loop will run for a fixed number of times, if the CAS does not succeed in these tries, the thread will "announce" for help by writing in it's id to a shared data structure.As soon as thread enters the increment(),it will first "help" all the operations that have been announced. PS:In my implementation,the counter is a structure consisting of integer value, thread id and other information.