CSE logo University of Washington Computer Science & Engineering
 CSE 451 Spring 2009
  CSE Home   About Us    Search    Contact Info 

Course Home
 Home
Administrivia
 Overview
 Using course email
 Email archive
 GoPost Forum
Materials
 Lectures and readings
 Sections
 Midterm and final
Assignments
 Homework
 Projects
Information
 Project information
 Linux information
 Forkbomb information
 Multiproc server info
   

forkbomb Information

Background

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:

  1. To make your life easier, by providing ample resources to get your work done.
  2. 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 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. 


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to Steve Gribble]