Question 17
Consider the following code snippet from Bakery Algorithm.
lock(i) { num[i] = MAX(num[0], num[1], ..., num[N-1]) + 1; for (p = 0; p < N; ++p) { while (num[p] != 0 && num[p] < num[i]); }}critical section
unlock(i) {num[i] = 0;}Considering there are 4 processes, and initially num[1]=0, num[2]=2, num[3]=1, num[4]=4, what will be the value of num[2] after running process 3 critical section?