1 Reply Latest reply: Apr 21, 2013 5:37 AM by EJP RSS

    Question on Thread concurrency

    1004380
      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;
      }