Optiver Interview Question

One question about using semaphone to achieve threads synchronization.