Assignment 5-B
Home ] Assignment 2 ] Assignment 3 ] Assignment 4 ] Assignment 5-A ] [ Assignment 5-B ] Assignment 6 ] Assignment 7 ] Errata / Updates ] Using Telnet ] Old Announcements ]
Updated:
1999-11-08 01:26

Home

Revised Nov 3: Assignment 5-B - UNIX - Section 040

This assignment is the second half of Assignment 5 for Section 040 - Ian Allen.

Hand in: The telnet log sheet from the last Hand In step in hard copy form.

Preparations:
    You must understand Chapters 6 and 8 to do this assignment.


Step 1.  (Readings in Chapter 6 and Chapter 8)

Use vi to create an answer file named c6+8answers containing answers to the questions listed in the Week 9 Reading Exercises.  Put your name on the first line of the file.  Answer only the following questions:
  • Answers to the Chapter 6 Reading Questions 6-5, 6-7, and 6-10.
             (For 6-10, type in the completed table numbered Table 6-2 on p.395)
  • Answers to the Chapter 8 Reading Questions 8-7, 8-9, and 8-11 through 8-15.

Make sure that your name is located at the top of the file.

Step 2.  (Based on Chapter 8 and Assignment 5-A)

  1. (New for Nov 3:) Change all occurrences of "ps -l" to "ps -f" in the scripts you wrote in Step 3 of Assignment 5.  The "-f" option prints the full Unix command name on ACADAIX.  The previous "-l" option truncates the command name, making it hard to know what the command names are.
  2. Redirect the output of each of the four command lines in Item C of Step 3 of Assignment 5-A into a file named processes.  The file must contain the output of all four command lines.  (Make sure you know how to do this: see Chapter 5 "Adding to an Existing File".)  Edit the resulting output file to remove the output of all of the echo $HOME commands.  (Do not remove anything else.)  Save the edited file.
  3. Using the process listings in the file processes, identify all the processes that were running in a process hierarchy list, showing which processes were parents of which children.  For example, some of your processes might have had the following relationships:
  4. PID        PPID        COMMAND
    12345     92939        ksh
    23456     12345        ps
    87465     12345        ksh
    45678     87465        ps
    ... etc ...
Create a file called hierarchy and type in a text diagram that shows the parent and child processes and their relationships, in the following form:
    	  -ksh (12345)
		|----------ps (23456)
		|----------ksh (87465)
				|------------- ps (45678)
				|------------- .....

Parent processes have vertical lines to which child processes are attached with horizontal lines.  (The process ID numbers will most likely be different for your processes when you do this.)

Step 3.  (Based on Chapter 8)

Practice these commands so that you can do them without errors.  You will redo them with logging turned on in the last Hand In step of this assignment.

  1. Issue the command line:
           sort | grep job | tee bb | wc
    and then immediately suspend the entire command line using CTRL-Z (^Z).  (For more explanation on how CTRL-Z works, look up CTRL-Z in the index of the textbook.)
  2. Issue the command         sleep 900 &
  3. Issue the command         ps
  4. Issue a command to kill only the wc process.
  5. Issue another command to kill only the sleep process.
  6. Issue a command to bring the suspended job (the suspended command line) back into the foreground.
    (The job in the foreground will now be expecting you to enter input for the sort command.)
  7. Type in the following lines for the standard input of the sort command:
       I started two jobs and
       killed some processes.
       Now I must complete the remaining job
       and wrap up my assignment.

    Press CTRL-D (^D) at the beginning of a line to indicate that you are finished typing input.  The foreground command pipeline should finish and you should get a shell prompt.  (If this doesn't happen, you have made an error.  Break out and repeat the steps.)
  8. Issue a command to show the permissions and size of just the file named bb created by the command pipeline.

Hand In:

Start telnet logging to record the following session on your A: diskette.  Perform only the following actions:
  1. Display your USER environmental variable.
  2. Display the date.
  3. Display the c6+8answers file created in Step 1.
  4. Display the edited file  processes created in Step 2.
  5. Display the file  hierarchy created at the end of Step 2.
  6. Do the commands listed in Step 3.
Stop logging and print the telnet log file for handing in.  This one log file is the only thing you should hand in.
 

Web Author: Ian! D. Allen idallen@ncf.ca
Updated: 1999-11-08 01:26