Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change semaphores into atomic counters #36

Closed
nojima opened this issue Apr 22, 2014 · 1 comment · Fixed by #39
Closed

Change semaphores into atomic counters #36

nojima opened this issue Apr 22, 2014 · 1 comment · Fixed by #39
Assignees

Comments

@nojima
Copy link
Collaborator

nojima commented Apr 22, 2014

Sometimes we want to change the capacities of semaphores after creating them.
It is possible that we implement a new command such as SET_CAPACITY.
But this approach introduces some complexity (e.g. how should we handle the case new capacity is smaller than current consumption).
Another solution is that a semaphore server does not manages the capacity of semaphore, and clients must specify the capacity in every acquire request.
This solution is simpler than SET_CAPACITY solution when clients always knows the current capacities.

@ymmt2005
Copy link
Member

As we discussed offline, I recommend to keep the current semantics as static semaphores because semaphores are so popular that we cannot remove them.

Instead, add another kind of semaphores called dynamic semaphores.

Unlike static semaphores, dynamic semaphores do not have fixed capacities; instead, every acquire operation for them need to specify the current capacity of the semaphore.

This way, yrmcds can be used as a flexible resource limiter.

@ymmt2005 ymmt2005 changed the title New semantics of semaphore extension Change semaphores into atomic counters Aug 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants