MCQ · 2 marks · Concurrency and Synchronization
GATE CS 2013 CS — Q39
A certain computation generates two arrays and such that for and for . Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array and Y computes the array . The processes employ two binary semaphores and , both initialized to zero. The array is shared by the two processes. The structures of the processes are shown below.
Process X:
private i;
for (i=0; i<n; i++) {
a[i] = f(i);
ExitX(R, S);
}
Process Y:
private i;
for (i=0; i<n; i++) {
EntryY(R, S);
b[i] = g(a[i]);
}Which one of the following represents the CORRECT implementations of ExitX and EntryY?