What is mutex and semaphore in Java ? What is the main difference?

前端 未结 11 1589
梦毁少年i
梦毁少年i 2020-11-27 09:28

What is mutex and semaphore in Java ? What is the main difference ?

11条回答
  •  不知归路
    2020-11-27 09:58

    You compare the incomparable, technically there is no difference between a Semaphore and mutex it doesn't make sense. Mutex is just a significant name like any name in your application logic, it means that you initialize a semaphore at "1", it's used generally to protect a resource or a protected variable to ensure the mutual exclusion.

提交回复
热议问题