Java / Java Multithreading
What is mutex in Java?
Official Definition is as follows: Mutexes are typically used to serialize access to a section of re-entrant code that cannot be executed concurrently by more than one thread. A mutex object only allows one thread into a controlled section, forcing other threads which attempt to gain access to that section to wait until the first thread has exited from that section.
Mutex stands for Mutually Exclusive Semaphore.
As an example, hotel management has a key to each room. One customer can have the key, use the room, at the time. When he checks out, the hotel management gives (frees) the key to the next customer in the queue.
More Related questions...