Can I initialize the counting semaphore as a negative value
Can I initialize the counting semaphore as a negative value?
Semaphore T = -2
Semaphore T1 = -1
If yes in which systems this can be used ? If no , is it not allowed in any system ?
Solution
Answer:
If you go through the definition of the semaphore, you will realize that semaphore count is declared unsigned integer :
Struct S
{
SpinLock_t lock ;
unsigned int COUNT;
}
It is clear from the definition of semaphore that the signed semaphore is not possible in any system.
