I need to design solution for below problem statement.
Problem Statement- Perl process gets initiated as user requests and takes some tasks(say n) to be done; then it handover this to a daemon process which is written in C++. Now out of those n tasks, if m tasks (m < n) has been comapleted then the output of these m taks should be returned immediately to same or different perl process and then rest result of n-m tasks when it gets completed.Now my problem is the communication between C++ and Perl. What should be the best way in term of speed of execution.
Problem Constraint- Perl code must be in Perl only, not in C++ due to some reasons.There will be multiple client, to send requet to C++ daemon.
Possible Solution- While submitting request to daemon I will return an unique ID to perl process.Then C++ daemon and the same or different perl process will use that ID to write/read output on/from one of the below.
1-FEFO Message Queue -- single Queue will be there; messages will be distinguioued by ID
2-mmap utility (memory mapped file) -- each file name will be uniq id
What seems to me that the benefit of second approach is speed of execution and further caching can be implemented very easily. But I am not sure that it will be the best solution.
Can anyone please suggest me how should I design solution? I may be missing some important aspects than please guide me for the same.