Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

p1, p2,. ... are processes, x. y, s ... are common variables. A, b, ... are loca

ID: 3769636 • Letter: P

Question

p1, p2,. ... are processes, x. y, s ... are common variables. A, b, ... are local variables. Consider two processes: p1, p2. The processes access one and only one common variable x and several local variables. A, b are local variables. Will the following problem has lost update? 4.1 PI will : Repeat 1000 time: c1 = x; c1- c1 + 1; x = c1 ; end repeat. P2 will : Repeat 1000 time: C2 = x; C2 = C2 - 1; x = C2; end repeat. P1 will : Repeat 1000 tine: c1 = a; c1=c1+1 a = c1; end repeat. P2 will : Repeat 1000 time: C2 = b; C2 = C2 - 1; b = C2; end repeat.

Explanation / Answer

Lost Update problem: Lost update refers to a situation when two or more concurrent(parallel) process access the same data and update it based on the value originally accessed instead of latest updated value. In such a case, one process will overwrite the updates of other process on the data.

Comments about 4.1: In the problem, it is not mentioned whether P1, P2 are concurrent processes. So, if we assume P1 and P2 are concurrent, there will be lost update problem as both are accessing and updating the common variable x. On the other side, if we assume P1 and P2 are not concurrent i.e. run after one another, there won't be any lost update problem as one will access the value of x updated by other.

Comments about 4.2: In this problem, there won't be any lost update problem whether P1 and P2 are concurrent or not, as they are updating seperate local variables a and b.