Return-Path: william@bourbon.usc.edu Delivery-Date: Fri Sep 19 22:23:09 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 m8K5N9N3018996 for ; Fri, 19 Sep 2008 22:23:09 -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 m8K5OwCD023034 for ; Fri, 19 Sep 2008 22:24:58 -0700 Message-Id: <200809200524.m8K5OwCD023034@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CSC551 Date: Fri, 19 Sep 2008 22:24:58 -0700 From: Bill Cheng Someone wrote: > The timeout for the select() and pthread_cond_timewait() is the > value returned by the getinterval() call. This value is converted > to the right units and the simulation works fine with expected > results( i.e. close to calculated values) but consumes too much > CPU cycle. If these threads are sleeping and your process is eating up CPU time, it must be other threads in your process that's eating up CPU time! What are your other threads doing? -- Bill Cheng // bill.cheng@usc.edu ----- Original Message ---- From: Bill Cheng To: cs551@merlot.usc.edu Sent: Friday, September 19, 2008 8:42:42 PM Subject: Re: CSC551 Someone wrote:   > I have tried using  select() and  pthread_cond_timedwait() to   > wait but my process still consumes a lot of CPU cycles. I always   > broadcast the condition mutex before calling any of these   > functions.Every thread goes into a while loop which loops until   > all arrivals have taken place and are serviced except if   > interrupted with a cntrl+C. Is there anything else I can do to   > reduce the CPU usage? What's the timeout for your select() and pthread_cond_timewait()? -- Bill Cheng // bill.cheng@usc.edu