Explain busy waiting semaphores.
Weak, Busy-wait Semaphores:
- The simplest method to implement semaphores.
- Useful while critical sections last for a short time, or we have many CPUs.
- S initialized to positive value to permit someone in at the beginning.
- S is an integer variable which, apart from initialization, can simply be accessed through 2 atomic and equally exclusive operations:
wait(s):
while (s.value != 0);
s.value--;
signal(s):
s.value++;
All occurs atomically that is, wrap pre protocols and wrap post protocols.