GATE Exam  >  GATE Questions  >  A certain computation generates two arrays a ... Start Learning for Free
A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n and
b[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrent
processes X and Y such that X computes the array a and Y computes the array b. The
processes employ two binary semaphores R and S, both initialized to zero. The array a 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?
  • a)
    ExitX(R, S) {
    P(R);
    V(S);
    }
    EntryY(R, S) {
    P(S);
    V(R);
    }
  • b)
    ExitX(R, S) {
    V(R);
    V(S);
    }
    EntryY(R, S) {
    P(R);
    P(S);
    }
  • c)
    ExitX(R, S) {
    P(S);
    V(R);
    }
    EntryY(R, S) {
    V(S);
    P(R);
    }
  • d)
    ExitX(R, S) {
    V(R);
    P(S);
    }
    EntryY(R, S) {
    V(S);
    P(R);
    }
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
A certain computation generates two arrays a and b such that a[i] = f ...
For computing both the array a[] and b[], first element a[i] should be computed using which b[i] can be computed. So process X and Y should run in strict alteration manner, starting with X. This requirement meets with implementation of ExitX and EntryY given in option C.
View all questions of this test
Explore Courses for GATE exam

Similar GATE Doubts

A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer?
Question Description
A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer?.
Solutions for A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer?, a detailed solution for A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A certain computation generates two arrays a and b such that a[i] = f (i) for 0 i < n andb[i] = g (a [i]) for 0 i < n . Suppose this computation is decomposed into two concurrentprocesses X and Y such that X computes the array a and Y computes the array b. Theprocesses employ two binary semaphores R and S, both initialized to zero. The array a isshared 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?a)ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}b)ExitX(R, S) {V(R);V(S);}EntryY(R, S) {P(R);P(S);}c)ExitX(R, S) {P(S);V(R);}EntryY(R, S) {V(S);P(R);}d)ExitX(R, S) {V(R);P(S);}EntryY(R, S) {V(S);P(R);}Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev