ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > 2017329621064-黎运泽 >
homework-4 Version 0
👤 Author: by theliyunzealiyuncom 2019-12-09 14:20:22
think about your possible case about process synchronization, and give out a solution for the problem.

 

say a = 10

process a and process b take a and do a -= 5 simultaneously :

p1 = a

p2 = a

p1 = p1 - 5

p2 = p2 - 5

a = p1

a = p2

so variable a is equal to 5 instead of 0 that we want.

solution:

using lock

 

 

 

Please login to reply. Login

Reversion History

Loading...
No reversions found.