Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jan 2000 23:12:10 -0800
From:      Jason Evans <jasone@canonware.com>
To:        Wes Peters <wes@softweyr.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Preemptiveness of FreeBSD threads
Message-ID:  <20000116231210.U302@sturm.canonware.com>
In-Reply-To: <3882BA78.4EE522F1@softweyr.com>; from wes@softweyr.com on Sun, Jan 16, 2000 at 11:45:12PM -0700
References:  <20000116225044.C601@unknown.nowhere.org> <20000116220322.T302@sturm.canonware.com> <3882BA78.4EE522F1@softweyr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000116231210.U302>