[Info-vax] HIBertanting DECthreads process accrues CPU time.

Jim Duff spam.this at 127.0.0.1
Fri Feb 11 07:40:28 EST 2011


On 11/02/2011 4:47 AM, VAXman- @SendSpamHere.ORG wrote:
> In article <00AAAC90.D13DDCBF at SendSpamHere.ORG>, VAXman-  @SendSpamHere.ORG writes:
> 
>> I have a process with three threads.  These three threads are created 
>> and then, sit on $HIBER until awakened when there is work to do.
>>
>> Occasionally, I will see this process (when started) accruing CPU time 
>> when there is nothing in terms of work for it to do.  I've put various 
>> markers in the code and *these* threads are not active.  I've used SDA 
>> and I've viewed the TEBs.  Stack highwater is well below each thread's 
>> stack limit.
>> ...
>> Does anybody have a clue as to what DECthreads is doing here?
>>
>> I am convinced there something horked in the thread scheduler.  Sadly,
>> I cannot use pthread_getcputime_np() on the several internal (negative
>> sequence number threads) which DECthreads has created to see which of
>> them is actually accruing this time.  I do know that it's not MY three
>> threads chewing up this time.
> 
> Here's some more info from SDA.  Note threads -2 and -4 are "running" 
> and are clocking up all the CPU time.  No idea why.  All of the other
> threads (and I took the time to name my threads) are going nothing at
> all.
> 
> 
> SDA> PTHREAD THREAD -af
> 
> [snip]

Cannot reproduce on IA64 8.3-1H1 with this code:

#include <stdio.h>
#include <stdlib.h>
#include <ssdef.h>
#include <stsdef.h>
#include <pthread.h>
#include <lib$routines.h>
#include <starlet.h>

static void *the_thread (void *arg) {

int r0_status;
pthread_t my_id;

    my_id = pthread_self ();

    r0_status = pthread_detach (my_id);
    if (r0_status != 0) {
        printf ("Thread %d can't detach\n", my_id);
        sys$exit ();
    }

    r0_status = sys$hiber ();
    printf ("Thread %d awake\n", my_id);

    pthread_exit ((void *)1);
    return (void *)1;
}


int main (void) {

int r0_status;
pthread_t thread_id[3];
int i;

    for (i = 0; i < 3; i++) {
        r0_status = pthread_create (&thread_id[i],
                                    0,
                                    the_thread,
                                    NULL);
        if (r0_status != 0) {
            printf ("Can't start thread\n");
            exit (EXIT_FAILURE);
        }
    }

    r0_status = sys$hiber();
}

Compiled with CC/REENT=MULTI
Linked with LINK/THREAD=(UP,MULTI)

What architecture/VMS version/pthreads version are you running, Brian?

You say "occasionally".  Does it happen after wakeups?  I'd be tempted
to swap out $HIBER and $WAKE for pthreads conditions and see if that
makes it go away.

Jim.
-- 
www.eight-cubed.com





More information about the Info-vax mailing list