Quantcast
Channel: VMware Communities : Popular Discussions - General Issues
Viewing all articles
Browse latest Browse all 41042

RHEL 5.4 guest OS has delayed pthread scheduling

$
0
0

Hi,

 

I've noticed that in RHEL 5.4, while the clock seems to be correct when I sleep a thread, if I do a pthread_cond_timedwait, there is an additional delay depending on how long I wait. So, for a:

 

1s  request -> 1s  wait

2s  request -> 3s  wait

5s  request -> 7s  wait

10s request -> 13s wait

30s request -> 41s wait

 

This does not happen for RHEL 4.x or 5.3. Is there anything I can do to fix this? Host OS is Windows Server 2008, two Xeon E5504 (quad cores). Guest CPU count=1.

 

Source code:

 

#include <time.h>

#include <unistd.h>

#include <stdio.h>

#include <pthread.h>

#include <sys/time.h>

 

int main() {

        pthread_mutex_t mutex;

        pthread_mutex_init( &mutex, NULL );

        pthread_cond_t cond;

        clockid_t clock = CLOCK_REALTIME;

        pthread_cond_init( &cond, NULL );

        struct timespec x;

        clock_gettime( clock, &x );

        printf( "%ld\n", x.tv_sec );

        x.tv_sec += 10;

        pthread_cond_timedwait( &cond, &mutex, &x );

        //usleep(10000000UL);

        clock_gettime( clock, &x );

        printf( "%ld\n", x.tv_sec );

        pthread_mutex_unlock( &mutex );

        pthread_mutex_destroy( &mutex );

        pthread_cond_destroy( &cond );

        return 0;

}


Viewing all articles
Browse latest Browse all 41042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>