I'm trying to order N processes using only semaphores (no mutex).
P1 -> P2 -> P3 -> ... -> Pn
Im dealing with this problem:
if you call:
s = 1;
P1 {
wait(s1)
...
signal(s1)
}
P2 {
wait(s1)
...
signal(s1)
}
How to prevent that it wouldn't start to loop in one proccess? Like the one process that released semaphore wont take it over again? I need all processes to get a turn eventually.
I would also appreciate any suggestions on how to solve this kind of problem (syncing N processes) ONLY using semaphores, without using N semaphores, I read that possible minimum is 3.
Thanks.