Re: [algogeeks] what will be the logic for this OS question?

2012-12-08 Thread naveen bansal
It wont work on any system actually. Suppose a case in which lock = 0 initially. And two threads are trying to execute the Critical Section. Thread 1 just passed the if branch and is about to execute the statement lock = 1; just before that context switch happened. Thread 2 will also enter into

[algogeeks] what will be the logic for this OS question?

2012-12-06 Thread zerobyzero
if (lock)wait else lock=1 CS lock=0 a. No issues b. works only for uniprocessor systems c. data insufficient d. won’t work on any system --