But this way the system behaves like three different, independant apps, this is good - I can stop, start, restart any part of it, and bad - it's three different daemons, and when I hand out maintainance to someone else I need to explain the inner workings of the system - it doesen't behave like a single system to them.
It's a bit like hmm, say, Oracle database, it consist of various important parts, and I would prefer it to behave more like single daemon, like apache webserver.
If I would merge this into single binary, that forks itself to handle various tasks, I would loose ability to easily manage those parts. So this is how it would look like with apps split into two parts:
Looks almost ok... but now with three parts:my $child=fork(); die "Can't fork: $!" unless defined $child; if ($child) { handle_task_one(); } else { handle_task_two(); }
Now it becomes unreadable. I got away with it when I created pool of worker 'threads', but with different functions I would prefer my code to look a little better.my $child=fork(); die "Can't fork: $!" unless defined $child; if ($child) { handle_task_one(); } else { my $childschild=fork(); die "Can't fork: $!" unless defined $childschild; if ($childschild) { handle_task_two(); } else { handle_task_two(); } }
In reply to Re: Re: How to efficiently manage bunch of processes
by Eyck
in thread How to efficiently manage bunch of processes
by Eyck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |