On 2/2/06, Michael Green <mishagreen@gmail.com> wrote:
On 2/2/06, Steve Graegert <graegerts@gmail.com> wrote:
Wow, such a quick reply...
gene1:~ # vi nproc.c gene1:~ # cc nproc.c -o nproc gene1:~ # ./nproc CHILD_MAX = 999
that means that a user cannot fork more than 999 processes?
Now suppose I run a fork bomb, the machine will die right away. Why? Cannot modern dual cpu computer handle a little more than 999 processes?
That's quite a lot. A user should never, never need so many processes. A mondern UNIX (and Linux) system can handle far more than 999 processes quite reliably. But consider a multi-user system with, say, 50+ users, everyone of them creating around 1000 processes. It's a nightmare. A fork bomb eats up all the process table entries and, due to its recursive calls to fork(), creates a huge amount of overhead that can bring systems down. It's actually not the number of processes that are difficult to handle but a fork bomb creates children of its children of its children... which means that memory is eaten up and even unwinding the stack afterwards to clean up is difficult. Limits like the one you asked for help to prevent fork bombs. \Steve -- Steve Graegert <graegerts@gmail.com> Software Consultant {C/C++ && Java && .NET} Office: +49 9131 7123988 Mobile: +49 1520 9289212