While a semaphore provides good means of controlling shared resource usage, issues like 'the dining philosophers problem' can arise when a thread needs to consume more than one resource to function.
Feature
Create an extended semaphore that provides
P(n) - consume n items or wait until they are available
V(n) - return n items
This can only work if waiting threads wait for resources in FIFO order. Otherwise, threads that require only 1 resource will take precedence and can create liveness issues for threads that require more than 1.
Background
Classic semaphore uses 2 methods:
While a semaphore provides good means of controlling shared resource usage, issues like 'the dining philosophers problem' can arise when a thread needs to consume more than one resource to function.
Feature
Create an extended semaphore that provides
This can only work if waiting threads wait for resources in FIFO order. Otherwise, threads that require only 1 resource will take precedence and can create liveness issues for threads that require more than 1.