Paul Clapham wrote:
Evan Yang wrote:Upon receiving the message, A, B and C are supposed to start their individual sub-tasks simultaneously, and finish working on the sub-tasks at the same time (this part can be controlled by a counter on the client side).
This is an extremely strange requirement. Start simultaneously? Finish at the same time? Why are those requirements? Why is it a problem if B starts a quarter of a second later than A and C?
Evan Yang wrote:I am thinking S can broadcast the initial message to A, B, and C via sockets. However, how can we ensure that the clients A, B, and C all start at the same time (e.g. what if the message to A arrives slightly later than the ones to B and C because of some network issue?)
You can't ensure that. There isn't even a way to monitor whether A, B, and C start at the same time, let alone enforce it.
Paul Clapham wrote:
Evan Yang wrote:In addition, the clients will send some messages back to the server at end of each of their sub-tasks. So S should only initiate the next 'round' of communication after it receives all the messages from the clients in the current 'round'. I wonder how we can enforce such behavior.
The server simply waits until it has received all of the messages. I'm not sure what you mean by "how we can enforce such behavior"... the simplest thing would be to have three boolean variables which record when each of the three messages have been received, for example. Was that the sort of question you meant that to be?