0 0 votes Consider the methods used by process $P_{1}$ and P2 for accessing their critical sections whenever needed, as given below. The initial values shared Boolean variables, $\mathrm{S}_{1}$ and $\mathrm{S}_{2}$ are random assigned.. \begin{tabular}{|l|l|} \hline Method used by $\mathrm{P}_{1}$ & Method used by $\mathrm{P}_{2}$ \\ \hline do & do \\ \hline 1 & 1 \\ \hline flag $[/]=$ True; \[ S_{1}=S_{2} \] & flag $[j]=$ True; \[ S_{1}=S_{2}+1 ; \] \\ \hline & \\ \hline & \\ \hline ) while(1); & ) while(1): \\ \hline \end{tabular} For the program to guarantee mutual exclusion, the predicate P and Q in the while loop should be a. $\mathbf{P}$ : Flag $[J]=$ true and $\mathrm{S}_{1}!=\mathrm{S}_{2}$ Q : Flag $[t]=$ true and $\mathrm{S}_{1}==\mathrm{S}_{2}$ b. $\mathbf{P}:$ Flag $[\eta]=$ true and $\mathrm{S}_{1}==\mathrm{S}_{2}$ $\mathbf{Q}:$ Flag $[t]=$ true and $\mathrm{S}_{1}!=\mathrm{S}_{2}$ $\mathbf{P}$ : Flag $[t]=$ true and $\mathrm{S}_{1}!=\mathrm{S}_{2}$ c. Q : Flag $[\lambda]=$ true and $\mathrm{S}_{1}=-\mathrm{S}_{2}$ $\mathbf{P}$ : Flag $[t]=$ true and $\mathrm{S}_{1}==\mathrm{S}_{2}$ d. $\mathbf{Q}$ : Flag $[J]=$ true and $\mathrm{S}_{1}!=\mathrm{S}_{2}$ Operating System operating-system semaphore test-series + – sanyam53 1.7k views answer comment Share Follow Print See 1 comment 1 1 comment reply Hradesh patel commented Jan 11, 2017 reply Follow flag is it B?? 0 0 replyShare Please log in or register to add a comment.
1 1 vote Correct Answer is A. Arnab Bhadra answered Apr 6, 2017 Arnab Bhadra comment Share Follow See all 3 Comments 3 3 Comments reply Souro_Nath commented Apr 27, 2017 reply Follow flag Opt A will disobey mutual exclusion 0 0 replyShare Abbas commented Jan 26, 2018 reply Follow flag yes bro you are right...answer should be A.. 0 0 replyShare Raj_81 commented Sep 7, 2019 reply Follow flag What is the problem with ans D? 0 0 replyShare Please log in or register to add a comment.
0 0 votes Correct Ans should be Opt B Souro_Nath answered Apr 27, 2017 Souro_Nath comment Share Follow 0 reply Please log in or register to add a comment.