GATEverse
← GATE CSE 2003

Q81

MCQ2 marks, −0.5

Suppose we want to synchronize two concurrent processes PP and QQ using binary semaphores SS and TT. The code for the processes PP and QQ is shown below.

Process P:Process Q:  while(1) { while(1) {W:Y: print ‘0’; print ‘1’; print ‘0’; print ‘1’;X:Z:}}\begin{array}{|l|l|}\hline \text{Process P:} & \text{Process Q: } \\\hline \text{ while(1) \{ } & \text{while(1) \{} \\ \text{W:} & \text{Y:} \\ \text{ print ‘0';} & \text{ print ‘1';} \\ \text{ print ‘0';} & \text{ print ‘1';} \\ \text{X:} & \text{Z:} \\ \text{\}} & \text{\}} \\\hline \end{array}

Synchronization statements can be inserted only at points W,X,Y,W, X, Y, and ZZ Which of the following will ensure that the output string never contains a substring of the form 01n001^n0 and 10n110^n1 where nn is odd?

Sign in to save attempts.

Loading…