您的位置:首页 > 编程语言 > Java开发

Java Semaphore and Condition Note

2016-03-17 21:01 441 查看
Semaphore is used to control the number of threads executing. There will
be fixed set of resources. The resource count will gets decremented every time when a thread owns the same. When the semaphore count reaches 0 then no other threads are allowed to acquire the resource. The threads get blocked till other threads owning resource
releases. In short, the main difference is how many threads are allowed to acquire the resource at once ? Mutex --its ONE. Semaphore -- its DEFINED_COUNT, ( as many as semaphore count) 
http://stackoverflow.com/questions/3513045/conditional-variable-vs-semaphore
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: