Exploring Processes Exercises


  1. Examining Processes

    1. Examine the processes you are currently running on your machine. View these several different ways using different flags (e.g. -x, -f, -u and combinations of these). Note these flags may behave differently based upon the specific Unix shell you are using. Make sure you understand most major groupings, such as process name, PID, PPID, STAT, etc. in each different view.

    2. Create a new process that will remain running, e.g. start a bash shell (bash). Now examine your processes as you did above and notice what has changed. Display the STAT information and explain what each letter indicates for each process.

    3. Terminate the shell process you just started and view your processes as above. Notice the PID for your original shell is the same, but the PID for the ps command is different. Can you explain this?

    4. Examine all of the processes currently running on your system and display with PID and PPID (try the flags -eaf). Locate your bottom-most (newest) process. Once finding this, follow this process up the process hierarchy via PPIDs until the top-most process is reached. Before actually doing this, what should the name of the top-most process be? Make sure you understand what each process is in your process tree.

    5. Now use the pstree command to view your processes. Examine your process hierarchy and relate this to the step above, displayed in a different format.

    6. Practice the above until you are sure you are comfortable with and understand these tasks.

  2. Overlaying Processes

    1. Examine (and make note of) the process information for the shell you are currently running.

    2. Now use the exec command to overlay your current process with a different shell (e.g. exec bash).

    3. Once complete, examine your process status again, noting the newly overlayed process as well as the PID of this process. Make sure you understand what happened and why?

  3. Terminating Processes

    1. Create two windows and login into your Unix machine via both.

    2. Use the ps command to view all of your processes, including both login sessions (e.g. -x flag). Make note of both shell processes, and try to determine which shell is running in which window. This may be done by time stamp, PID, or you may need to use the tty command.

    3. Set focus to one of the terminal windows and use the kill command to terminate the login connection in the other. What process do you need to kill to terminate the login connection?

    4. Make sure you understand what happened and why?.


©2003-2004, Mark A. Thomas. All Rights Reserved.