<< Previous exercise (3.40)
| Index |
Next exercise (3.42) >>
No, if you get balance in different order with withdraw and deposit, you will get different result. but all they all legal.
I disagree. I think the answer is yes. Another process could access balance mid-withdraw or mid-deposit and get the wrong info.
It's not wrong info. If a withdraw or deposit isn't finished, then the original balance is still valid. Accessing balance is a single operation, it cannot be interleaved with other procedures. Therefore, we don't need to protect it.
I believe the book uses these two requirements on concurrency:
An "unprotected" access to balance fulfills both requirements so I would say it does not really matter.