Date: Sun, 16 Jan 2000 22:18:56 -0700 From: Wes Peters <wes@softweyr.com> To: Michael Bacarella <mbac@nyct.net> Cc: Alexander Litvin <archer@lucky.net>, hackers@FreeBSD.ORG Subject: Re: Preemptiveness of FreeBSD threads Message-ID: <3882A640.2A63B02A@softweyr.com> References: <Pine.BSF.4.05.10001162336110.179-100000@bsd1.nyct.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Michael Bacarella wrote:
>
> > Program, when killed with SIGINT, prints all counters and exits.
> >
> > Now, as I understand, userspace threads in FreeBSD are preemptive.
> > So, though my 11 threads are all computational and do not do
> > any syscalls, sleeps, sched_yield, whatever -- newertheless,
> > the program should not be stuck in one thread. And it seems to
> > be sometimes true. But only sometimes!
>
> Hmmm, my prior response was pretty much bullshit. It doesn't work
> for me with 'volatile' at all.
>
> [...]
>
> Putting a sched_yield(); in the loop body makes sure that they get their
> fair share, so, other than guessing FreeBSD is at fault, I'm out of ideas. :)
Yup, that does it, but it makes the program several orders of magnitude slower,
too. Be careful about how much you use sched_yield, you're pushing the system
into behavior that is outside its normal operating design. FreeBSD wasn't
designed to re-run the scheduler after 2 or 3 instructions.
--
"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?3882A640.2A63B02A>
