Just to be sure: this clock frequency is independent of whether you run with 1 thread or 2 threads, right? (Except that with 2 threads you see 2 cores at about 3700 Mhz and with 1 thread only 1 core.) Then turboboost is not the culprit and you probably have a bug somewhere (for lack of a better explanation).Evert wrote:Good point.syzygy wrote:On your Linux system you could try using i7z to check the frequencies at which the cores are running.
They idle at 1600 MHz (using the "ondemand" governor) but switch to about 3700 MHz once the program starts. Then there is some variation on the level of 3650-3700 MHz until they clock back down to 1600 once the program finishes.
With gcc you can use the __sync_fetch_and_add() builtin for this. Alternatively, use a spinlock instead of a mutex.Pulling the move from the move list is done under a mutex, but it wouldn't have to be if "my_move_number = split_point->current_move_number++" would be an atomic operation, but I don't think it is.
From your initial post:
Maybe you do this already, but it is more efficient to first check for idle threads (e.g. by checking an idle thread counter) and only if there are, take the mutex and check again.This function checks (behind a mutex) if there are threads that are marked as WAITING.