Sunday, September 9, 2012

What is mutex and semaphore in Java ? Difference between mutext and semaphore

What is mutex and Semaphore in Java
Mutex and Semaphore in Java both used to provide mutual exclusion for critical section of code but they are completely different to each other. If you want a block of code can be only executed by one thread at a given time you usually lock that portion of code using a mutext which is achieved by using synchronized keyowrord in Java.

No comments:

Post a Comment

Feel free to comment, ask questions if you have any doubt.