how to implement "buffering"
I have a little problem of implementation of a buffer in my project. There is a distributed system, where there are a Boss and a fixed number of Servants.
Servants have to do tasks(implemented by the "sleep" function).
The Boss has to send a "CHECKPOINT"request to the Servants. After Servants has received that message from the Boss, they have to memorize their own state (the number of tasks) in stable storage. While doing that, no message has to be send. So if a Servant gets a CHeCKPOINT message from the Boss, then it has to buffer the task(s) it was doing, and save its own state in memory.
Now the question is: how can I implement the buffer?
At the moment, every servant has an input LinkedList for the incoming messages, and an output LinkedList for the outgoing messages. When it has to do a task, the servants read the first taask to do from the incoming linkedList. So if it is doing task and in the meanwhile a CHECKpoint-request comes, it has to be able to buffer the task and reply to the CHECKPOINT REQUEST.
Thank you for your attention and for your answers!