CSE 451, Introduction to Operating Systems, Spring 2013
Forkbomb Information
Background
forkbomb is a Linux machine devoted to this course. There are two reasons behind this:
- To make your life easier, by providing ample resources to get your work done.
- To make everyone else's life easier, by keeping you away from them.
That said, part of the reason to have forkbomb is because it's expected that debugging your 451 assignments will sometimes cause you to execute "fork bombs" - processes that go into loops forking new processes. When that happens, (a) there are lots of processes to run, so the system becomes very sluggish, and (b) eventually, your userid exceeds its process limit, and you (individually) can no longer do anything, including issuing the kill command needed to stop the fork bomb (because it requires forking a new process to execute, and you can no longer fork processes).
Protecting Yourself
Here is some useful information from CSE Support, allowing you to take precautionary steps against fork bombs. To make sense of it, it helps to know that there is a system-imposed limit on the number of processes each user can have at any time, as well as a user-settable limit on the number of descendants each process can have. You can implement it by putting the required command in your ~/.bash_profile file (or equivalent, if you're using some shell other than bash).
Q: Is there any way for a user to kill the set of processes in a fork infinite loop themselves (or is the only recourse to send mail to CSE Support)?
A: If the process runs away, and consumes all of your allowed process slots, there's nothing you can do. However, you can run your assignment in a shell window with a lower process limit so that you can kill the runaways in the other shell. Basically:
- Open two sessions to forkbomb.
- In ONE of the sessions issue the command: "limit maxproc 64" (or an even lower number). Then run your code from that session. This will give you at least 64 free process slots in the other session to be able to kill any runaways.
If using bash use "ulimit -Su 64" or a lower number.
- Course Home
- Administrivia
- Materials
- Assignments
- Information
Computer Science & Engineering University of Washington Box 352350 Seattle, WA 98195-2350 (206) 543-1695 voice, (206) 543-2969 FAX