Your threads work like one thread. Find local min and max and then use mutex for synchronization with global max and min