GATEverse
← GATE CSE 2024 Set 1

Q30

MCQ2 marks, −0.67

Consider the following two threads T1\mathrm{T} 1 and T2\mathrm{T} 2 that update two shared variables a\mathrm{a} and b\mathrm{b}. Assume that initially a=b=1\mathrm{a}=\mathrm{b}=1. Though context switching between threads can happen at any time, each statement of T1\mathrm{T} 1 or T2\mathrm{T} 2 is executed atomically without interruption. T1a=a+1; b=b+1;\begin{gathered}\mathrm{T} 1 \\ \mathrm{a}=\mathrm{a}+1; \\ \mathrm{~b}=\mathrm{b}+1;\end{gathered} \quad T2b=2∗b;a=2∗a;\begin{gathered}\mathrm{T} 2 \\ \mathrm{b}=\mathrm {2 * b}; \\ \mathrm{a}=\mathrm 2 * {a}; \end{gathered} Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?

Sign in to save attempts.

Loading…