From - Mon Aug 04 07:36:56 1997 Path: news.mitre.org!blanket.mitre.org!nntprelay.mathworks.com!news.mathworks.com!cam-news-hub1.bbnplanet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!news1.digital.com!pa.dec.com!crl.dec.com!lead.zk3.dec.com!zk2nws.zko.dec.com!usenet From: Dave Butenhof Newsgroups: comp.os.vms Subject: Re: UCX & PThreads Performance Problems Date: Fri, 01 Aug 1997 10:04:50 -0400 Organization: Digital Equipment Corporation Lines: 48 Message-ID: <33E1ED02.1CFB@zko.dec.com> References: NNTP-Posting-Host: kalkin.zko.dec.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01Gold (X11; I; OSF1 X4.2 alpha) Phil Penney (YRL) wrote: > > We're using DECthreads POSIX 1003.1c in an application on an Alpha > running VMS V7.1 and UCX V4.1 ECO Level 4. > > I notice an unacceptable delay when using condition variables which are > taking 0.45 seconds elapsed time from a pthread_cond_signal() in one > thread to the waking of a second thread sitting on pthread_cond_wait(). > > 2 other threads are waiting on sockets using the recvfrom() function with > no flags set - nothing arrives at the sockets while the condition variable > is being tested. When I remove these 'socket' threads from the application > the condition variable delay is 0.06 seconds. Assuming that upcalls are enabled, "waiting on a socket" should end up making the thread wait on a condition variable within the thread library. However, if upcalls are not enabled (either for the system or for the image), then a blocking kernel call will stall the PROCESS (and all thread) until a timeslice AST occurs. My guess is that this is what's happening. > Has anyone used the combination of pthread condition variables and socket > functions without noticing performance problems? Obviously any suggestions > would be gratefully received! Check the MULTITHREAD sysgen parameter. If it's set to 0, both upcalls and kernel threads are disabled for the system. If set to 1, upcalls are enabled, but multiple kernel threads are disallowed. Otherwise, the value is the number of kernel threads created per process (which should usually be the number of processors in the system). In addition, the main image must be linked with /THREADS_ENABLE=(UPCALLS,MULTIPLE_KERNEL_THREADS) If it's not, then a process running that image will be unable to create multiple kernel threads, or avoid blocking the process on kernel calls, regardless of the MULTITHREAD parameter. If you need to change those flags in an image that you've already built, try this: $ set command sys$update:threadcp $ threadcp /enable=(upcalls,multiple_kernel_threads) /dave /---------------------------[ Dave Butenhof ]--------------------------\ | Digital Equipment Corporation butenhof@zko.dec.com | | 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof | | Nashua NH 03062-2698 http://www.awl.com/cp/butenhof/posix.html | \-----------------[ Better Living Through Concurrency ]----------------/