CCR:
-- the condition is checked inside the critical section, and the
waiting is done outside the critical section.
-- the condition is checked by the implementation of the CCR.
How the condition is checked and how going in and out of the CS and
how the condition is rechecked and re-re-checked is an implementation
issue that I did not cover in class, and called it magic. I did not
cover it as CCR is no longer part of the book and hence considered no
included in the course material. Also CCR is not a method used is
programming today, so it has been put to rest. Sad.
Dining Philosophers:
The solution does not have deadlocks or starvation. It however suffers
from the problem that is Philo 1 is waiting for chop 2, then Philo 0
cannot eat. Philo 0 gets stuck at the P(mutex). Hence it is not a good
solution. Also, it uses the nasty programming method of blocking
inside a mutex, which is just plain bad programming.