OA. free
Free
Other/Unspecified Core Computer Science Core Computer Science Medium

Question 6 Two threads, T1 and T2, use the following synchronization mechanism to control...

Other/Unspecified technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Two threads, T1 and T2, use the following synchronization mechanism to control access to a shared resource.

Thread T1:

flag1 = true;
while (flag2) {
  // critical section
}
flag1 = false;

Thread T2:

flag1 = true;
while (flag1) {
  // critical section
}
flag1 = false;

Which of the following statements best describes the behavior of this synchronization method?

Pick ONE option

Choose one option.
Show answer & explanation
Answer: A. A) Deadlock is avoided, but the shared resource can be accessed by both threads simultaneously

Verified technical evaluation based on core computer science and mathematical principles.

Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.