
James Mansion wrote:
The post operation that 'wakes up' is V, not P.
Ooops, yes, I meant V.
If your api allows V(4) to release 4 resources atomically, then 4 consumers in P must be released (if they are waiting, and any left over accrued to allow future consumers not to block. Even if you say V(4) is not supported and actually V;V;V;V and these are atomic individually, then there is still a race between those four posts and any Ps actually getting to run. Either way, you MUST enable 4-off Ps to become ready. If the API allows to post multiple resources atomically, then you need to handle this.
No, the API just allows V(1). And VxN operations is what I'm suggesting if N resources are freed by the producer. Is it usual to have V(N) in semaphores? I have never seen it. Best, Ion