Date: Mon, 11 May 2009 11:06:02 +0100 From: Andrew Brampton <brampton+freebsd-hackers@gmail.com> To: freebsd-hackers@freebsd.org Cc: Ryan Stone <rysto32@gmail.com> Subject: Re: kthreads and sched_relinquish Message-ID: <d41814900905110306j74265660qba98032b1caa482a@mail.gmail.com> In-Reply-To: <bc2d970905081059k58d3541fte0f004d9fc753a39@mail.gmail.com> References: <d41814900905081024m2a67b037w91a4611aa633ab52@mail.gmail.com> <bc2d970905081059k58d3541fte0f004d9fc753a39@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/5/8 Ryan Stone <rysto32@gmail.com>: > Your kernel thread likely has a higher priority than userspace threads. > > Ryan Stone > Thanks for your reply Ryan. So that I understand this correctly, if I had two kernel threads, one with a high priority, and one with a low priority, and both are PRI_TIMESHARE, then the high priority thread will run uninterrupted until it sleeps? Or is it that kernel threads trumps userspace threads? >From my experience in userspace, all threads will get a chance to run, even if there is a higher priority thread ready to run. The exact problem I am having is that this code (written by someone else) has implemented their own spin locks (which of course does not sleep), so when the lower priority user thread obtains the lock, and higher priority thread sometimes gets rescheduled before the user thread has released the lock. Now the high priority thread spins forever waiting for it to be released, which doesn't seem to give the lower thread a chance. Of course the correct solution to this is to remove these custom built spin locks and start to use the locking mechanisms provided by FreeBSD. While I've started to do that, I wanted to explore this more for my general understanding. thanks Andrew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d41814900905110306j74265660qba98032b1caa482a>