From: Julian S. <js...@ac...> - 2003-04-08 21:25:00
|
Sefer, I tested the program you sent me (below) and it behaves identically running on V from normal; no timing anomalies. This is running on a 1133Mhz PIII-T (desktop) machine. I suspect Jeremy may be right about the power management thing; he's had a patch available for that for a while. Can you clarify the situation re power management on your platform? Thanks. J #include <pthread.h> #include <stdio.h> #include <unistd.h> void *start(void *p) { printf("Hi!\n"); sleep(1); printf("Here\n"); sleep(1); return 0; } int main() { pthread_t tid; void *p; int i; for ( i = 0; i < 5; ++i ) { pthread_create(&tid, 0, start, 0); } pthread_join(tid, &p); return 0; } On Tuesday 08 April 2003 10:12 am, Jeremy Fitzhardinge wrote: > Quoting Sefer Tov <se...@ho...>: > > Hi! > > > > I've been testing a short threaded program, and I noticed that sleep(x), > > > > although utilizes no cpu, it schdules poorly (the program slows down > > almost > > to a halt). > > Is your machine a laptop, or a desktop with power management enabled? > Valgrind uses the TSC register as its timebase, and I've noticed on my > laptop the TSC doesn't advance when the machine is idle. You can easily > tell if this is the case: if you run a CPU-bound program at the same time, > then the TSC advances at near full speed and the sleeps are for the right > time. > > J |