CCR doubt

12 views
Skip to first unread message

Rahul Shah

unread,
Mar 25, 2012, 7:32:02 PM3/25/12
to asu-cse-430
Professor,

In CCR as you mentioned if the boolean is true the thread which was
blocked enters the CS where again it confirms Boolean condition is
true or not. I have a doubt that who checks the boolean condition
outside CS and if it is true why does it check again while in CS?

One more doubt is in Dining Philosophers:

P(mutex)
P[i]; P[i+1];
V(mutex)
V[i]; V[i+1];

In this solution how is the deadlock present. If P0 has chopstick 0
and 1 and P1 comes it will be blocked inside mutex but eventually
resume after P0 releases the chopsticks. That means there is a
starvation but I cant understand how is the deadlock present in this
solution.

Partha

unread,
Mar 25, 2012, 9:03:47 PM3/25/12
to asu-cse-430

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.

Rahul Shah

unread,
Mar 31, 2012, 3:55:35 PM3/31/12
to asu-cse-430
okay..!..tht solves my doubt..
Reply all
Reply to author
Forward
0 new messages