forkbomb is a Linux machine devoted to this course.
There are two reasons you might imagine are behind
the department's devoting a machine to a single course:
- 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
Here is some useful information from 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 support)?
A: If the process runs away, and consumes all of their allowed process
slots, there's nothing they can do. However, they can run their
assignment in a shell window with a lower process limit so that they
can kill the runaways in the other shell. Basically:
Open 2 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.