Compare Mutex and Semaphore in java.
Answer / Mukteshwar Yadav
Both are synchronization primitives used for controlling access to shared resources. However, they work differently:nnMutex (Monitor): It is a lock that allows only one thread to access the protected resource at a time. A mutex has a binary lock and can be in two states - locked or unlocked.nSemaphore: It is a generalization of mutexes, which allows multiple threads to access the protected resource if there are sufficient permits available.nIn Java, Mutex is implemented using synchronized blocks or methods, while Semaphores can be created using the java.util.concurrent.Semaphore class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Why is java architectural neutral?
Define the term string pool?
Is finalize() similar to a destructor?
Can an abstract class have a constructor?
What is methodological theory?
what is difference between Interface and abstract class
can we create object for static class in java
14 Answers IAP Company, IBM, Marlabs, mPortal, TCS,
how to create a jar file in java
What is difference between throw and throws ?
What is the difference between equals() and == in java?
What are the 6 boolean operators?
What is bufferedwriter?