3 votes 3 votes What is Lock Variable solution to critical section problem? Does it satisfy all the conditions like Mutual exclusion, Bounded waiting and Progress? Theory of Computation operating-system critical-section + – Warlock lord asked Aug 20, 2017 • retagged Aug 21, 2017 by Bikram Warlock lord 3.2k views answer comment Share Follow See all 12 Comments See all 12 12 Comments reply Show 9 previous comments Pinaki Dash commented Aug 21, 2017 reply Follow Share @Bikram Sir, I was not talking about Peterson's or Dekker's. I was referring to the simplest algo using Lock variable only and nothing else, for which I have written the pseudocode above. Thanks for all the references. 0 votes 0 votes Bikram commented Aug 21, 2017 reply Follow Share @pinaki yes, i have seen it.. but the thing is we use lock to ensure Mutual exclusion property. see the definition of lock , it is an object that can only be owned by a single thread at any given time . so that means no two threads can acquire a same lock at same time , which leads to Mutual exclusion, is not it ? And there are 2 operations we can perform on a lock: acquire: mark the lock as owned by the current thread; if some other thread already owns the lock then first wait until the lock is free. Lock typically includes a queue to keep track of multiple waiting threads. release: mark the lock as free (it must currently be owned by the calling thread). So all it means ME is satisfied using Lock .. infact the purpose of lock is this . And a good CS problem satisfy all 3 conditions like ME, BW and progress. 0 votes 0 votes Arpon commented Nov 19, 2021 reply Follow Share lock variable does NOT guarantee MUTUAL EXCLUSION BOSS. those who are watching, don’t go by this. i think bikram you are making a mistake. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Refer to this PDF: https://cseweb.ucsd.edu/classes/fa05/cse120/lectures/120-l5.pdf smsubham answered Aug 21, 2017 smsubham comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Peterson and Dekker's algo, both solves : ME, BW and progress these three conditions. Also progress is satisfied so deadlock is not possible ( bcoz progress done in finite time where as deadlock is infinite waiting). Reference : https://cs.stackexchange.com/questions/12621/contrasting-peterson-s-and-dekker-s-algorithms ( see 2nd answer , the table) https://cs.stackexchange.com/questions/60235/is-bounded-waiting-ensured-in-given-version-of-dekkers-solution-for-critical-se Bikram answered Aug 21, 2017 • edited Aug 21, 2017 by Bikram Bikram comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments Shivansh Gupta commented Aug 21, 2017 reply Follow Share I mistook Dekker's as strict alternation.. 0 votes 0 votes Shivansh Gupta commented Aug 21, 2017 reply Follow Share yes Dekker's satisfies all the three properties. 0 votes 0 votes Karan Dodwani 1 commented Aug 23, 2018 reply Follow Share @Bikram Sir, In my understanding Lock Variable does not hold Mutual Exclusion and Bounded Waiting it can only hold Progress. (If_i_am_Wrong) Please give an example on Lock Variable . 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes lock variable solution does not satisfy Mutual exclusion. sh2mohit111 answered Oct 12, 2017 sh2mohit111 comment Share Follow See all 0 reply Please log in or register to add a comment.