B09 Lab week 9

This is an exercise in finding and terminating processes running in the background.

In future assignments, you will implement programs that fork a lot, and you will make mistakes resulting in child processes continuing to run behind your back. If this happens on Mathlab or a lab computer, you are slowing down computers that other people need, and you are not being a good citizen! It is important that you find and terminate these runaway processes.

To practice this, compile and run the provided imtrash.c program. What it does: fork 5 children, then exit; but the children are still running! (In this lab, the children idle for 20 minutes then exit, no harm done in case you fail this mission. In reality, mistakes will likely cause children to actively hog the CPUs forever.)

Your jobs:

  1. How do you find the PIDs of those processes? (One of them plays a trick to try to be harder to find!)
  2. How do you terminate them?

Keep in mind that a lot of other students may have similarly named processes too (when everyone is doing the same assignment on the same server). You must find and terminate those belonging to you only.

What to hand in: Write down your command(s) and/or clearly (but concisely) describe your method(s) in a text file cleanup.txt and submit it. It will be marked by a TA.