Skip to content

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

GateBrew
← GATE CSE 2024 Set 1
Questions

Q30

MCQ2 marks, −0.67Operating systems

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.

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