Initializes semaphore sem with a count of count. Semaphores in the kernel are normally allocated statically (i.e., Semaphore x;) and must be initialized (semInit(&x, 1);) before they are used.
void semInit(Semaphore *sem, int count)
Increments the use count for the semaphore. The current thread will either acquire the semaphore sem or give up control until a semSignal is done by another thread and the scheduler runs.
void semWait(Semaphore *sem)
The current thread decrements the use count for semaphore sem. The current thread continues executing. Note that if multiple threads are blocked on the semaphore, there is no policy about which thread will be awakened by the semSignal.
void semSignal(Semaphore *sem)