Date: Sun, 16 Jan 2000 23:45:12 -0700 From: Wes Peters <wes@softweyr.com> To: Jason Evans <jasone@canonware.com> Cc: Alexander Litvin <archer@lucky.net>, hackers@FreeBSD.ORG Subject: Re: Preemptiveness of FreeBSD threads Message-ID: <3882BA78.4EE522F1@softweyr.com> References: <20000116225044.C601@unknown.nowhere.org> <20000116220322.T302@sturm.canonware.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
--
"Where am I, and what am I doing in this handbasket?"
Wes Peters Softweyr LLC
wes@softweyr.com http://softweyr.com/
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?3882BA78.4EE522F1>
