I haven't used the Semaphore strange enough...
Anyway I was reviewing some code using it and saw that unlike locks, a permit can be released by another thread (i.e. no ownership).
I looked into Concurrency in Action and it says (p.98):
The implementation has no actual permit objects....so a permit acquired by one thread can be released by another
I didn't notice this detail before and looked into an OS textbook I have that said (my emphasis):
When one process modifies the semaphore value no other process ....etc
So is this Java specific design decision? I mean that a semaphore is not owned by a thread.
Or am I misunderstanding the concept of semaphore?
Note: This is not a question of whether this is a good/bad design etc. I am just trying to be sure I understand the concept