• Description:
    Like exercise 5, a process tree is created according to argv[]. Each process will handle at lease two signals. When one of them, for example SIGUSR1, is received, the labels will be printed in preorder. See following example. When another signal, for example SIGQUIT, is received, the overall tree is removed. You may need the pipes between processes.
  • Deadline: 2010 May 20 00:05am
  • Put your file(s) under ~/usp-982/exer8
  • Examples :
                      shell
                        | 
                        a
                       / \
                      b   e
                     / \   \
                    c   d   f
    $ ./a.out ddduduudduuu abcdef
    I'm c, my pid=19979, and my ppid=19978
    I'm d, my pid=19981, and my ppid=19978
    I'm f, my pid=19982, and my ppid=19980
    I'm a, my pid=19977, and my ppid=19767
    I'm b, my pid=19978, and my ppid=19977
    I'm e, my pid=19980, and my ppid=19977
                                                   $ kill -USR1 19977
    hello, i'm a, my pid is 19977 
    hello, i'm b, my pid is 19978
    hello, i'm c, my pid is 19979
    hello, i'm d, my pid is 19981
    hello, i'm e, my pid is 19980
    hello, i'm f, my pid is 19982
                                                   $ kill -USR1 19979   
    hello, i'm c, my pid is 19979
                                                   $ kill -USR1 19980
    hello, i'm e, my pid is 19980 
    hello, i'm f, my pid is 19982
                                                   $ kill -USR1 19978
    hello, i'm b, my pid is 19978 
    hello, i'm c, my pid is 19979
    hello, i'm d, my pid is 19981    
                                                   $ kill -QUIT 19977
    $ 
    
  • My code for exercise 5.