Forking programs are quite nice regarding the possibility to create subprocesses for parallel computing or to make good use of Multi-Core- or Multi-CPU-Systems. But you can really shoot yourself in the knee with that!
Really nice is something called a Fork Bomb, which can be implemented very easily with several different languages. The variants shown below can be entered directly on the command line, which makes the no less dangerous. So, please, take care with them:
:(){ :|:& };:perl -e 'fork while 1'Both programs don't serve a reasonable purpose except forking and then reloading itself. So the keep forking on and on until the whole system stops working because of the huge number of processes that have been created. So, the Fork Bomb poses a very simple implementation of a denial of service that can only be dealt with by limiting the number of processes per user in /etc/security/limits.conf like that:
@users soft nproc 300
@users hard nproc 400
When the Fork Bomb has be streted without prior precautions, your owned. The system will freeze and don't respond anyomore.
Two hints regarding this issue:
And, no, it wasn't me who gathered experience this way!