Date: Mon, 7 Jul 2003 10:14:02 -0400 (EDT) From: Daniel Eischen <eischen@vigrid.com> To: Petri Helenius <pete@he.iki.fi> Cc: freebsd-threads@freebsd.org Subject: Re: thread scheduling priority Message-ID: <Pine.GSO.4.10.10307071001220.4752-100000@pcnet5.pcnet.com> In-Reply-To: <3F096E56.4010609@he.iki.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 7 Jul 2003, Petri Helenius wrote: > I have two threads on a SMP (2 CPU, HT disabled) box with world+kernel > from mid-June. (cvsupping to latest right now) and a process which > runs two threads with the following code snippet, more or less in a process > & maintenance (collecting statistics, doing housekeeping, etc.) fashion. > While > the main thread does it's stuff it competes for a mutex with the other > thread. However > I'm observing that the thread created in the snippet below has hard time > getting > scheduled while the main thread is running. First, you should say what threading library you are using. I'll answer assuming you are using libkse (if you aren't, ignore me). Try forcing libkse to use one KSE. By default, libkse will create as many KSEs as CPUs that you have. It is possible that there is a problem with trying to keep both KSEs active when you only have 2 threads and one or more of them block or sleep. To do this, set kern.threads.debug=1 and kern.threads.virtual_cpu=1: # sysctl kern.threads.debug=1 # sysctl kern.threads.virtual_cpu=1 Also, the default scheduling policy is SCHED_RR and the RR interval is 20msec. If your main thread is in a busy loop, no other threads will run for 20 or so msec (assuming 1 KSE). -- Dan Eischen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10307071001220.4752-100000>