I am going to put this algorithm (attachment) in my code and however this code supposbly works and but it seems to me you could have a race condition if two adjacent philosophers try to aquire forks at the same time. in the take forks function if both philosophers execute the
up(&mutex) then try to iniate the down(&s[i]), I can't see what is going to prevent them from blocking each other. Does anyone understand this and would not mind assisting how its going to allow one to get forks and keep the other waiting to get them?