Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2013
Questions

Q39

MCQ2 marks, −0.67Operating systemsMedium

A certain computation generates two arrays a and b such that a[i]=f(i)a[i] = f(i) for 0≤i<n0 \leq i < n and b[i]=g(a[i])b[i] = g(a[i]) for 0≤i<n0 \leq i < n. Suppose this computation is decomposed into two concurrent processes XX and YY such that XX computes the array aa and YY computes the array bb. The processes employ two binary semaphores RR and SS, both initialized to zero. The array aa 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?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.