Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Sep 8 23:01:47 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8961lEm032206 for ; Mon, 8 Sep 2008 23:01:47 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8960ue9016681 for ; Mon, 8 Sep 2008 23:00:56 -0700 Message-Id: <200809090600.m8960ue9016681@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Terminating Child Processes Date: Mon, 08 Sep 2008 23:00:56 -0700 From: Bill Cheng Someone wrote: > when timeout occurs (time to auto shutdown the server), should server wait > for all child processes to terminate or forcefully kill the child processes > using Kill command and than terminate itself? You must not *forcefully* kill the child processes or child threads. The kill() API can be used to deliver a signal to a child process. It's not the same as killing a child process (unless you send the SIGKILL or SIGSTOP signals which cannot be caught). Please see: http://merlot.usc.edu/cs551-f08/projects/warmup1.html#graceful If you are using child threads, you should not just call pthread_cancel() to kill a child thread *forcefully*. -- Bill Cheng // bill.cheng@usc.edu