0

Can anyone help me explain the total meaning of this paragraph?

Exercise 3.43: Suppose that the balances in three accounts start out as $10, $20, and $30, and that multiple processes run, exchanging the balances in the accounts. Argue that if the processes are run sequentially, after any number of concurrent exchanges, the account balances should be $10, $20, and $30 in some order. Draw a timing diagram like the one in Figure 3.29 to show how this condition can be violated if the exchanges are implemented using the first version of the account-exchange program in this section. On the other hand, argue that even with this exchange program, the sum of the balances in the accounts will be preserved. Draw a timing diagram to show how even this condition would be violated if we did not serialize the transactions on individual accounts.

Source

There are many things I do not understand in this paragraph. My questions are:

  • "if the processes are run sequentially, after any number of concurrent exchanges," - as I understand it, the word "sequential" and "concurrent" mean contradictory things. As far as I know "sequential" means one at a time and "concurrent" means occuring at the same time or simultaneous. I translated this as: if the processes are run one at a time, after any number of simultaneous exchanges. How could simultaneous things be happening if things happen one at a time? I am totally confused.
  • "the account balances should be $10, $20, and $30 in some order." - Does this mean we should find out all orders of exchanges that lead to three banks having $10, $20 and $30 respectively?
  • "the sum of the balances in the accounts will be preserved." - This is a little clearer. Does preserved means "the account balances should be $10, $20, and $30 in some order." just like what is said previously?

Can anyone totally explain things I don't understand. Thanks.

1
  • 2
    I'm voting to close this as off-topic because it is not a single question; the individual questions do not look fully acceptable on ELU either. Commented Jul 3, 2018 at 16:46

1 Answer 1

1

Argue that if the processes are run sequentially, after any number of concurrent exchanges, the account balances should be $10, $20, and $30 in some order.

I believe this means that the requests are happening concurrently, but the program is queuing them up and processing them sequentially.

"the account balances should be $10, $20, and $30 in some order." - Does this mean we should find out all orders of exchanges that lead to three banks having $10, $20 and $30 respectively?

No, they are asking for a logical argument that the values $10, $20, $30 must exist in the accounts in some order after the process completes.

Suppose the accounts are named A, B, and C. Let's say A has $10 and B has $20. After an exchange A would have $20 and B would have $10. Since all exchanges happen in a sequential way, they want you to argue that the amounts are always preserved.

On the other hand, argue that even with this exchange program, the sum of the balances in the accounts will be preserved.

I believe they are now referring to concurrency as defined in the first version of the program. They are asking for a proof that the sum of A, B, C would be 10 + 20 + 30 = 60.

This is difficult to answer without understanding the problem fully. In particular, we would need to understand the concurrent nature of read / writes in the problem.

Furthermore, it seems the first version of the program already has some serialization. They want a proof that if it were removed, then A + B + C = 60 would also be violated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .