Lock / Mutex / Semaphore

Lock : A general term for any synchronization mechanism that prevents concurrent access to a shared resource. When a thread acquires a lock, others must wait until it&rsquo;s released. Mutex : A lock that only allows one thread in at a time, with strict ownership. Only the thread that locked it can unlock it. If another thread tries to acquire an already locked mutex, it blocks until the owner…