There are several locks used for chess programs, spinlocks, mutexes etc.
So, as I am currently implementing SMP into FruitFly, would it be worth the hassle of converting the Toga mutexes to C++11 atomic locks?
Matthew:out
C++11 atomic locks
Moderator: Ras
-
ZirconiumX
- Posts: 1361
- Joined: Sun Jul 17, 2011 11:14 am
- Full name: Hannah Ravensloft
C++11 atomic locks
tu ne cede malis, sed contra audentior ito
-
mcostalba
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: C++11 atomic locks
Considering that you failed to understand that C++1 atomic library does not cover lock functionality I'd strongly suggest to stay with what you know better (or at least you think to know).ZirconiumX wrote:There are several locks used for chess programs, spinlocks, mutexes etc.
So, as I am currently implementing SMP into FruitFly, would it be worth the hassle of converting the Toga mutexes to C++11 atomic locks?
Matthew:out
-
bob
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: C++11 atomic locks
First question is, what is your goal? Max performance on a dedicated machine? Use nothing but spinlocks. If you are going to compete for CPU resources with other running processes (non-chess processes) then a traditional mutex that spins and then blocks is the way to go... I only care about the former myself, not the latter.ZirconiumX wrote:There are several locks used for chess programs, spinlocks, mutexes etc.
So, as I am currently implementing SMP into FruitFly, would it be worth the hassle of converting the Toga mutexes to C++11 atomic locks?
Matthew:out
-
Daniel Shawul
- Posts: 4186
- Joined: Tue Mar 14, 2006 11:34 am
- Location: Ethiopia
Re: C++11 atomic locks
OpenMP locks have an interesting property. They act as spinlocks for a certain time and then as a mutex in which the thread is put to sleep. They will probably act fully as spin locks when it is our turn so no loss there. http://www.thinkingparallel.com/2006/09 ... roduction/
-
Daniel Shawul
- Posts: 4186
- Joined: Tue Mar 14, 2006 11:34 am
- Location: Ethiopia
Camel is a horse designed by a committee
That was the conclusion of a recent Dr Dobb's article after discussing concurrency in C11. http://drdobbs.com/cpp/232800444?pgno=1