Sonoma State University
Department of Computer Science
CS-210: Introduction to Unix
Exercise 5: Signals and Process Control

Objective:

In this exercise, you will use the following UNIX commands to identify and terminate processes:

  • ps
  • kill

Instructions:

Inside your home directory on Blue, please perform the following tasks:

  • cd cs210_exercises/cs210_exercise_5
  • wget https://www.robertjamesbruce.com/programming_exercises/cs210/fall_2024/cs210_exercise_5.tgz
  • tar xzf cs210_exercise_5.tgz

Question: How do I terminate process?

Note: When you run the program "sleeper" (in the tar archive from above), it will automatically launch three processes before returning you to the Unix command prompt.

Please provide me (your instructor) with a live demonstration of the following tasks:

  1. Run the "sleeper" program by typing: ./sleeper
  2. Using the UNIX 'ps' command, look up the processes the sleeper program launched.
  3. Identify the process identification numbers for each process the sleeper command launched.
  4. Using the kill command and appropriate process identification (PID) number, terminate one sleeper process with the HUP (-1) signal.
  5. Using the kill command and appropriate process identification (PID) number, terminate one sleeper process with the INT (-2) signal.
  6. Using the kill command and appropriate process identification (PID) number, terminate one sleeper process with the KILL (-9) signal.
  7. Using the ps command again, verify that no more sleeper processes are running.

Submission Instructions:

Since this is a live demonstration exercise, there is nothing for you to submit for this exercise.

Exercise 5 Rubric

CRITERIA RATINGS POINTS
Live demonstration:
Student provides a live demonstration on how to identify and terminate a process with various UNIX kill signals.
Proficient
2 points

Student identified the PID (process ID) for all processes launched by sleeper program. Student terminated one sleeper program with the HUP signal. Student terminated one sleeper program with the INT signal. Student terminated one sleeper program with the KILL signal. Student verified that no more sleeper processes are running in their terminal.
Satisfactory
1.4 points

Student needed help identifying the process IDs for the processes launched by sleeper. Student terminated one sleeper program with the HUP signal. Student terminated one sleeper program with the INT signal. Student terminated one sleeper program with the KILL signal. Student verified that no more sleeper processes are running in their terminal.
Needs Improvement
1 point

Student needed help identifying the process IDs for the processes launched by sleeper. Student needed help sending a kill signal to one or more processes. Student needed help determining if any of the processes launched by sleeper program were still running.
Below Expectation
0 points

Student has not provided me with a live demonstration for the tasks outlined in exercise 5.
2 points
Total points: 2