2 2 votes what is true about binary semaphore? 1)Binary semaphore has drawback called busy wait or spin lock. 2)Binary semaphore is applicable only for two processes 3)Binary semaphore has no drawback called busy wait or spin lock 4)none of the above Operating System semaphore + – ajit 4.3k views answer comment Share Follow Print See 1 comment 1 1 comment reply Hradesh patel commented Feb 15, 2021 reply Follow flag I think option 1 and 2 is correct But option 2 is more accurate.. Please check.. 0 0 replyShare Please log in or register to add a comment.
3 3 votes For 1) and 3) from galvin and wikipedia, it says that "Traditional semaphore has drawback of busy waiting aka spinlock but In a slightly modified implementation which is using the Queue overcome this problem" So 1) and 3) both are depends on implemenation. For 2) although binary semaphor is applicable for only 2 processes but we can implement counting semaphor using Binary semaphor. reena_kandari answered Jun 22, 2017 reena_kandari comment Share Follow See 1 comment 1 1 comment reply ed_word commented Aug 9, 2018 reply Follow flag Binary semaphore can work for more than 2 processes. The 'binary' in binary semaphore comes from the fact that it allows only one process to enter a critical section or use a particular resource. Thus a resource can either be free (1) or not free (0). Whereas there can be multiple processes in busy-wait state waiting to acquire a lock on this process. Consider an example with 3 processes. Process 1 acquires a lock on the resource setting the semaphore value to 0. Now process 2 tries to access the resource but fails since it can't acquire a lock so it busy-waits. Same goes with process 3. The above example can be scaled for n processes where n>=1 0 0 replyShare Please log in or register to add a comment.
1 1 vote This link will solve your query...kindly check disavdantage. http://gateoverflow.in/?qa=blob&qa_blobid=18345140180365630159 Sabrina answered Jun 12, 2017 Sabrina comment Share Follow See 1 comment 1 1 comment reply arpit_18 commented Feb 11, 2021 reply Follow flag Which book? 0 0 replyShare Please log in or register to add a comment.
0 0 votes Answer should be (3) struct Bsemaphore { enum value(0,1); Queue type L;// list of all processes get // blocked while performing down operation usuccessfully } Bsemaphore s: s.value=1; Down(s); Down(Bsemaphore s) { if(s.value==1) { s.value=0; } else { put the process in s.L and block it sleep(); } } Up(Bsemaphore s) { if(s.L() is empty) { s.value=1; } else { select a process from s.L(only one process) wakeup(); } } ajit answered Sep 12, 2015 ajit comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes i think there is no such drawback instead it uses a diffrent mechanism which was made to overcome the problem of busy wait and spin lock . which is sleep procedure till someone is inside the critical section don't knock at the door just go to sleep when there will be a space the process will wake u up . the process of busy waiting is a charterstic of lock variable not of semaphonre Tendua answered Sep 13, 2015 Tendua comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Ans 1) as per Galvin, Binary semaphore has drawback called busy wait or spin lock. In B. Sem, the value never comes negative, it ranges (0,1). When Sem.value ==0 then busy wait happens. pps121 answered Aug 24, 2016 pps121 comment Share Follow 0 reply Please log in or register to add a comment.