2 votes 2 votes WHAT HAPPENS WHEN WE WRITE CODE IN THE CRITICAL SECTION IN SUCH A WAY THAT WE CALL THE WAIT() ON THE BINARY SEMAPHORE WE ALREADY CALLED A WAIT() ON ?? DEADLOCK WITH A SINGLE PROCESS ??? IS THIS POSSIBLE ?? Operating System operating-system deadlock-prevention-avoidance-detection + – Venkat Sai asked Sep 5, 2017 Venkat Sai 257 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes This will not occur, I think. As you are entering a critical section, the binary semaphore is already decremented to 0, so wait() cannot be called again on it. So, no deadlock. Utsav09 answered Sep 6, 2017 Utsav09 comment Share Follow See 1 comment See all 1 1 comment reply Venkat Sai commented Sep 6, 2017 reply Follow Share in case of non rentrant locks in threads when a thread acquires lock once and the it tries to acquire the same lock again then it gets blocked this can result in a deadlock with single process what i was asking is if we can write a wait() call within the critical section again as generally we have wait() CS signal() for a binary semaphore and CS contains code for shared resources but what happens if we design in such a way that we call wait() inside CS again so it should be blocked and this will cause a deadlock as it will wait forever in the blocked queue as it itself waits for itself .... 0 votes 0 votes Please log in or register to add a comment.