I understand questioning the sanity of mixing forks and threads. The reason for wanting to mix the two is that I have to open up 300+ connections to unique devices. When I do this using threads, the process size grows to 2-3G due to the nature of ithreads. Once the threads are closed, perl stays at that memory size until the process has exited. I have done a lot of reading and the conclusion seems to be that perl never give memory back to the OS until the process is done running. In my case, this process stays running for weeks.
Now, if I use forks, once the linux threads(forks) are done, the memory is given back to the OS.
So, I thought, let's just use forks everywhere! this would be great as they will give the memory back and they use COW. But, I found that some of the code in this program uses globs and forks doesn't support globs therefore I can't use forks for other sections of this program.
I only see 2 viable solutions:
1. use forks and threads (hence the reason for my post)
2. use a thread pool for the section of code that opens up the 300+ connections and limit the number of threads at any given time to some value a lot lower than 300. I am going to prototype using a thread pool and see if the open time is still acceptable.
But, if I was able to unload forks and reload threads it would make my life easier :-)
Thanks much
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.