parallel by using pthread
use barrier waits instead of spin waits