On Sun, Jan 16, 2000 at 11:45:12PM -0700, Wes Peters wrote:
> Jason Evans wrote:
> > 
> > You don't mention how long you run the program for, so I'm assuming that
> > the runtime must be quite short for you to be seeing the results that
> > concerned you.  All tests that I ran showed non-zero counters for all
> > threads if the program ran for more than 1.5 seconds.
> 
> wes@homer$ time ./threadtest
> ^C
> Thread 0x00: 0
> Thread 0x01: 0
> Thread 0x02: 0
> Thread 0x03: 0
> Thread 0x04: 0
> Thread 0x05: 0
> Thread 0x06: 0
> Thread 0x07: 0
> Thread 0x08: 0
> Thread 0x09: 0
> Thread 0x0a: 223277111
> 
> real    0m5.403s
> user    0m5.256s
> sys     0m0.001s
> wes@homer$ uname -a
> FreeBSD homer 3.3-RELEASE FreeBSD 3.3-RELEASE #4: Thu Dec 23 14:45:28 MST 1999     
>rootb@homer:/usr/src/sys/compile/HOMER  i386
> 
> Adding a sched_yield() in the main function before the call to start_my_thread
> seems to solve the problem:
> 
> wes@homer$ time ./threadtest
> ^C
> Thread 0x00: 20767331
> Thread 0x01: 25057587
> Thread 0x02: 21035219
> Thread 0x03: 18914176
> Thread 0x04: 8465648
> Thread 0x05: 16969167
> Thread 0x06: 16848430
> Thread 0x07: 16359150
> Thread 0x08: 16933300
> Thread 0x09: 16607575
> Thread 0x0a: 12583271
> 
> real    0m4.585s
> user    0m4.476s
> sys     0m0.011s

Okay, so much for that theory. =) Also, I finally saw the reported
behaviour twice, though when I recompiled, it went away.  This could be
hard to track down...

Jason


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to