optimize semophore