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.

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 all

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site