Lock and Thread in JAVA

http://lavasoft.blog.51cto.com/62575/99155

1. What is Mutex and Semaphore?

Mutex(mutual exclusion): mutual exclusion refers to the requirement of ensuring that no two concurrent processes[a] are in theircritical section at the same time; it is a basic requirement in concurrency control, to prevent race conditions. Here, a critical section refers to a period when the process accesses a shared resource, such as shared memory.

Semaphore: a semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a concurrent system such as a multiprogramming operating system.

【?】二者区别:http://blog.csdn.net/zwan0518/article/details/8761000

reference:

https://en.wikipedia.org/wiki/Semaphore_(programming)

原文地址:https://www.cnblogs.com/hygeia/p/4851956.html