Next: int bufid =
Up: int pvm_send_work_packet(int id);
Previous: Client side
- Extract the opcode and the worker class id of the message. Also get the tid of the sender task (farmer task).
- Using the tid, and the default message tag, receive another message from the
farmer task. This would contain the work packet to be processed.
- Call the scheduler with the worker class id and the message buffer id and the message tag of the buffer message.
- In the scheduler, using the worker class id, locate the WCitem which contains the information about the work packets.
- If no worker class item is found, then return an ERROR.
- Find out if any worker task is free by checking if the item returned by asking for an item which has no packets pending, is NULL.
- If yes, then using the tid of the task, send the message buffer to the worker task giving the message tag information and the buffer id.
- Clear the buffer used to receive the message and look for other messages.
- If there are no workers which can handle the message, then check the list of work packets. If it does not exist, create it and use the pointer to
the list of work packets and append the current packet to the end of the list of work packets associated with the worker class.
- Go back and check for other messages arriving at the server.
Sameer Shende