default value of a mutex
I have 2 doubts
1)what is the default value of a mutex ?
Is it 0 or 1?
2)Why cant we have a code like, this to solve the Concurrency issues. I mean, i know its not possible, but this was asked to me at an interview ...
if(pid == 1)
{
/* give CS to Process1 */
set pid =2;
}
else
{
/* give CS to Process2 */
set pid=1;
}
tubby123
Junior Poster in Training
98 posts since May 2011
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0
pyTony
pyMod
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
thanks for the reply ,
default value - what i meant was, say, the Producer-consumer Problem , where Producer puts something into the queue until the limit of the queue(n) and the Consumer consumes from it until 0.
So, initially does the queue have anything in it ??
That is, can the consumer consume anything initially ???
tubby123
Junior Poster in Training
98 posts since May 2011
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0
Can you eat any bread if no bread have been produced?
pyTony
pyMod
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26