This discussion is archived
1 Reply Latest reply: Apr 21, 2013 3:37 AM by EJP RSS

Question on Thread concurrency

1004380 Newbie
Currently Being Moderated
If two threads execute the below method increment() concurrently, how many different final values of X are there? You may assume that initially X has value 0.

void increment()
{
int temp = x;
temp = temp + 1;
x = temp;
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points