I recently opened Perl and I am very in love. But one thing concerns me - if I just split processes from left to right, this will certainly cause some kind of problem. Is there a reasonable check that needs to be used to make sure that my small application does not eat up all the resources of my machine?
Take this sample code:
foreach my $command (@commands) { my $pid = fork(); if (!$defined $pid) {
Thus, this will work fine and output the processing of each command. All this will happen in parallel, which is great if these teams are completely independent.
What if I suddenly have 5,000+ teams? It would be unreasonable to mindlessly abandon many processes. So which check should be implemented and how?
)
source share