Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process Deluge on Linux

Tags:

linux

sysadmin

I tried this experiment on my Linux desktop:

int main()
{
  while(1)
    fork();
  return 0;
}

I ran this program as normal user(not root), i was surprised to find that it brought down my system, it has become unresponsive. I had hoped that due to resource limit exhaustion my process would have been killed,but apparently this is not the case. Any ideas why?

thanks, Sid.

PS: this was my office Linux box on which i was experimenting from home, i hope everything will be okay when i restart it tomorrow ....

like image 826
Al pacino Avatar asked Jan 18 '09 13:01

Al pacino


3 Answers

You've re-invented a fork bomb.

I think most Linux distributions don't set per-user resource limits by default. You can configure them of course, but you probably haven't.

The machine will be fine after a reboot - unless the CPU usage has caused over-heating problems.

To prevent an ordinary user from spawning too many processes you need to add configuration to /etc/security/limits.conf

You can use ulimit to set limits that would apply to your current session if you think you're going to run a program that might start too many processes or use up too much of other resources.

like image 59
Douglas Leeder Avatar answered Oct 12 '22 00:10

Douglas Leeder


you can find stuffs about that on wikipedia.

like image 41
Aif Avatar answered Oct 12 '22 01:10

Aif


Most likely, your system administrator didn't set up the user limits. If no user limits are set, then they can't protect anyone.

like image 27
Jörg W Mittag Avatar answered Oct 12 '22 00:10

Jörg W Mittag