Date: Fri, 5 Dec 2008 15:02:25 +0000 From: "Ray Kinsella" <raykinsella78@gmail.com> To: freebsd-performance@freebsd.org Subject: Re: Thread priority in FreeBSD Message-ID: <584ec6bb0812050702j7dbf5b54k87d2cb4e4f6fa8b4@mail.gmail.com> In-Reply-To: <584ec6bb0812050701t4bcccb1fr214370f4535ae1d0@mail.gmail.com> References: <584ec6bb0812050701t4bcccb1fr214370f4535ae1d0@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Apologies, I neglected to clarify, I am of course talking about Kernel Threads. On Fri, Dec 5, 2008 at 3:01 PM, Ray Kinsella <raykinsella78@gmail.com>wrote: > Hi all, > > I have a problem trying to influence thread scheduling in FreeBSD. > There are three threads I am interested the priority of:- > > a. Enqueue Thread: > - Enqueues data in a circular buffer > > b. Interrupt Handler: > - Signals that data in the circular buffer has been processed and in ready > for removal > - Queues an entry on a task queue so the data is removed from the circular > buffer asynchronousily > - Data is processed by a pci card > > c. Task Queue Thread: > - Dequeues request from a task queue. > - Dequeues data from the circular buffer. > > *Objective: > > *I want to prioritise the *Enqueue Thread, *such that it will always > executes until the circular buffer is exhausted of space. > I want the *Task Queue Thread* to have the lowest priority such that it > only runs when the *Enqueue Thread* has no work to do. > > *Observed behaviour: > > *I set the *Enqueue Thread, *to have a priority of PRI_MAX_KERN (0) > I set the *Task Queue Thread,* to have a priority of PRI_MIN_KERN (64) > > In the main I see the following scheduling:- > > ... > *Enqueue Thread, *Enqueues serveral requests on the circular buffer > *Interrupt Handler*, Interrupts the *Enqueue Thread, *puts requests on a > taskqueue for async processing. > *Task Queue Thread, *Dequeues the request from a taskqueue and the data > from the circular buffer > *Enqueue Thread, *Enqueues serveral requests on the circular buffer > *Interrupt Handler*, Interrupts the *Enqueue Thread**, *puts requests on a > taskqueue for async processing. > *Task Queue Thread, *Dequeues the request from a taskqueue and the data > from the circular buffer > .. > > No matter what I do with thread priorities, the *Task Queue Thread *always > follows the *Interrupt Handler. > * > *Ideal behaviour* > > Ideally I would get the following behaviour, were *Enqueue Thread *will > always run instead > of *Task Queue Thread *thread while it has work to do. > > *Enqueue Thread, *Enqueues serveral requests on the circular buffer > *Interrupt Handler*, Interrupts the *Enqueue Thread, *puts requests on a > taskqueue for async processing. > *Enqueue Thread, *Enqueues serveral requests on the circular buffer > *Interrupt Handler*, Interrupts the *Enqueue Thread**, *puts requests on a > taskqueue for async processing. > *Enqueue Thread, *Enqueues serveral requests on the circular buffer > *Interrupt Handler*, Interrupts the *Enqueue Thread**, *puts requests on a > taskqueue for async processing. > *Enqueue Thread, *yields timeslices as the circular buffer is maxed out > *Task Queue Thread, *Dequeues the request from a taskqueue and the data > from the circular buffer > *Task Queue Thread, *Dequeues the request from a taskqueue and the data > from the circular buffer > *Task Queue Thread, *Dequeues the request from a taskqueue and the data > from the circular buffer > > Any idea's how to encourage the scheduler to adopt this behaviour ? > > Thanks > > Ray Kinsella > > * > > > * >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?584ec6bb0812050702j7dbf5b54k87d2cb4e4f6fa8b4>