I have a Client/Server model where each client can send a Task to the Server - This is called Task Requesting.
This is a base for a simple distributed-computing library i am after.
"In other words, if some ordinary application processes an array of independent elements, then in a data-parallel model, each processor is assigned to process some part of array. To support data-parallel computing, the core library should divide tasks into parts, transfer task data to the local memory of a particular CPU, run the task on that CPU, transfer results back to the caller, and provide the ability to request some global data from the caller."
- A Task is a Binary(std::vector uint8_t) and a Payload(std::vector uint8_t).
- A Binary is just an compiled task / application.
- A Payload is optional data that is serialized into a uint8_t.
So simply:
class CGridTask
{
public:
...
bool Run ();
private:
std::vector<uint8_t> m_vBinary;
std::vector<uint8_t> m_vPayload;
uint32_t m_uiUniqueId;
...
}
The pseudo-diagram shows how it 'works':
[CLIENT1]---[SEND TASK with PAYLOAD: integer value = 10]-->[SERVER]
[SERVER]-->[RUN TASK with PAYLOAD]
[TASK, start]
[TASK, calculate...]
[TASK, calculate...]
[TASK, calculate...]
[TASK, integer value = 10 + some new value]
[TASK, return]
[SERVER]-->[SEND TASK to CLIENT1]
Ok, so when server calls:
pGridTask->Run();
Here is what should happen:
bool CGridTask::Run()
{
// Dump the binary to a temporary file
Dump(m_vBinary);
// Chmod +x
system("chmod +x " + strTempopraryBinaryName);
// Run the binary and pass m_vPayload
...how can i do this?...
// Return true if binary executed
return true;
}
The only problem here is to share the m_vPayload with the executed binary... How can i do this?
Thank you very much for any input into this!