3 3 votes Assume that you have a semaphore associated with each item on a doubly linked list. Using No other synchronization primitive, What is the fewest number of semaphore that you must acquire for any operation (lookup, insert, delete) ? Operating System operating-system semaphore linked-list + – mcjoshi 1.9k views answer comment Share Follow Print See all 8 Comments 8 8 Comments reply Show 5 previous comments Kapil commented Oct 13, 2016 reply Follow flag This is what i was thinking. suppose we are reading from a node 4 and other thread comes and deletes node 3 then, we have to modify 2 pointers . But that can be done, if question says that there is no possibilty of deadlock and multithreading is there . Since, it is not concerned about these problems, why not lock the complete list. 0 0 replyShare mcjoshi commented Oct 13, 2016 reply Follow flag When complete list in locked using one semaphore, then it may be the case that all operations are performed from the side that performs UP on semaphore. 0 0 replyShare Kapil commented Oct 13, 2016 reply Follow flag Not many up operations, if we use mutex then only 1 at a time will take the control. 0 0 replyShare Please log in or register to add a comment.
0 0 votes 1 DeadMann answered Oct 16, 2022 DeadMann comment Share Follow 0 reply Please log in or register to add a comment.