Semaphores and Critical
Sections
ä For n processes
ä Initialize S.count to 1
ä Then only 1 process
is allowed into CS
(mutual exclusion)
ä To allow k processes
into CS, we initialize
S.count to k
Process Pi:
repeat
  wait(S);
   CS
  signal(S);
   RS
forever