ngoc_huy_nt
30-10-2010, 22:05
tình hình là thầy em bắt dịch đoạn tiếng Anh này, nhưng nói thật là môn tiếng Anh en học dở lắm, trên VOZ có anh chị nào rành thì dịch dùm em, em cảm ơn nhìu nhìu. :adore::adore:
Answer: To prove property (a) we note that each Pi enters its critical section only if flag[j] = false. Since only Pi can update flag[j], and since Pi inspects flag[j] only while flag[i]=true, the result follows.
a. To prove property (b), we first note that the value of the variable turn is changed only at the end of the critical section. Suppose that only process Pi wants to enter the critical section. In this case, it will find flag[j]=false and immediately enter the critical section, independent of the current value of turn. Suppose that both processes want to enter the critical section, and the value of turn = 0. Two cases are now possible. If Pi finds flag[0] = false then it will enter the critical section. If Pi finds flag[0] = true then we claim that P0 will enter the critical section before P1. Moreover, it will do so within a finite amount of time.
b. To demonstrate this fact, first consider process P0. Since turn = 0, it will only be waiting for flag[1] to be set to false; more precisely, it will not be executing in the begin block associated with the if statement. Furthermore, it will not change the value of flag[0]. Meanwhile, process P1 will find flag[0] = true and turn = 0. It will set flag[1] = false and wait until turn = 1. At this point, P0 will enter its critical section. A symmetric argument can be made if turn =1. 6.4 The first known correct software solution to the critical-section problem for n processes with a lower bound on waiting of n
Answer: To prove property (a) we note that each Pi enters its critical section only if flag[j] = false. Since only Pi can update flag[j], and since Pi inspects flag[j] only while flag[i]=true, the result follows.
a. To prove property (b), we first note that the value of the variable turn is changed only at the end of the critical section. Suppose that only process Pi wants to enter the critical section. In this case, it will find flag[j]=false and immediately enter the critical section, independent of the current value of turn. Suppose that both processes want to enter the critical section, and the value of turn = 0. Two cases are now possible. If Pi finds flag[0] = false then it will enter the critical section. If Pi finds flag[0] = true then we claim that P0 will enter the critical section before P1. Moreover, it will do so within a finite amount of time.
b. To demonstrate this fact, first consider process P0. Since turn = 0, it will only be waiting for flag[1] to be set to false; more precisely, it will not be executing in the begin block associated with the if statement. Furthermore, it will not change the value of flag[0]. Meanwhile, process P1 will find flag[0] = true and turn = 0. It will set flag[1] = false and wait until turn = 1. At this point, P0 will enter its critical section. A symmetric argument can be made if turn =1. 6.4 The first known correct software solution to the critical-section problem for n processes with a lower bound on waiting of n