This is a potential problem with the following solution to the Dining Philosopher's problem.

    Shared data:
       semaphore chopstick[5];
    Initially all values are 1
    
    Philosopher i:
       do {
          wait(chopstick[i]);
          wait(chopstick[(i+1) % 5]);
           . . .
            eat
           . . .
          signal(chopstick[i]);
          signal(chopstick[(i+1) % 5]);
           . . .
            think
           . . .
       } while (1);