I would like to know is it possible to process the array elements while the
array itself if being updated(storing elements) using some parallel
processing technology in perl...
If the update is only adding elements, you want a queue. Use shared
memory between two processes. IPC::ShareLite may work, for example.
collector process:
1) get new data
2) put new data at end of a list (the queue)
3) is the shared memory full? if yes, go to (1)
4) put the oldest data (at the beginning of the queue) in shared
memory
5) go to (1)
computational process:
1) is there new data in shared memory? if no, go to (1)
2) get new data and process it
3) empty shared memory
You can get much fancier, but this is probably enough to do what you
need. It's a basic "dropbox" method. Note it's not, by far, the only
way to manage data, but the key with parallel processing is to
simplify as much as possible. The simplest solution will work best; a
complex solution will be a nightmare to debug when bugs could be in 1
of N processes.
If you want more processing, increase the number of computational
processes and give each one a separate shared memory dropbox.
Ted