Q2) Write a python program that uses processes to edits a global variable. Your program should have: (8 Marks) • The glo
Posted: Mon Jun 06, 2022 6:33 pm
Q2) Write a python program that uses processes to edits a global variable. Your program should have: (8 Marks) • The global variable: "account_balance" • The function "deposit_balance(amount)" which takes "amount" as a float parameter, and adds it to the global variable "account_balance". The function "withdraw_balance(amount)" which takes "amount" as a float parameter, and withdraws it from the global variable "account_balance". • Two processes that invoke the two functions above. Note that "amount" should be entered by the user and passed to the processes. • Make sure that the data is consistent (Use a proper lock on the variable).