Perl-Sensitive Sunglasses | |
PerlMonks |
Re^2: Is it possible to create a single Hash-of-Hash.. with multiple threads..by gsat (Initiate) |
on Apr 25, 2014 at 01:17 UTC ( [id://1083703]=note: print w/replies, xml ) | Need Help?? |
Thanks much for your time. Your code is simple & works fine - I guess because it is simple 2 level deep & the subroutine is not increasing the depth while working. The data structure - I am handling with, will increase the structure depth. Basically branch-out, like a growing tree, every thread working on a unique branch is OK. As other suggestions came like - Storing output in a new structure - and finally merging it - is fine - how to return different sized depth of every branch structure varying between 9 to 14, number of branches would few tens of thousands - and join them to form the final tree. The starting structure that I need to share across threads - will be having depths like 4-6 level, when threads finished working every branch will have 9-14 levels. BTW, in my experience, the %hash kind of usage are not very convenient, rather - I prefer reference of hash-ref-of-hash-ref - right from the root. I used to like..
Overall - so far in my understanding - perl threads is not cool, no matter what - It really cannot do big job with complex data structure in shared way - absolutely no references shared between threads. Internally every thread is creating another copy, so with GBs of data-structure I cannot really launch many threads. My single-thread serialized code is working great though - it can do serious work on massive data-structures. It lacks true parallelism.. Perl Threads implementation so far, seems very inadequate - it is good for primary school student exhibiting how parallel programming works. I wish next gen threads will be able to do what I am asking - seamless work on the shared structure over GPUs too [why not - being Interpreted, won't stop it running in GPU I guess. :) - anyway Thanks a lot again!!
In Section
Seekers of Perl Wisdom
|
|