what are the differences among mutex, condition variables, and semaphore?
If multiple threads are hang on a lock, are they maintained in a queue? When another thread signals the lock, will the first thread in the queue be released, or it randomly pick one thread to release?