From owner-freebsd-current Fri Nov 23 20:11:27 2001 Delivered-To: freebsd-current@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 2F04337B417; Fri, 23 Nov 2001 20:11:24 -0800 (PST) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id fAO4BNM60853; Fri, 23 Nov 2001 20:11:23 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id C0DE038FF; Fri, 23 Nov 2001 20:11:23 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Luigi Rizzo , John Baldwin , current@FreeBSD.ORG Subject: Re: where is the idle_loop in current ? In-Reply-To: <20011124023641.56C0F380D@overcee.netplex.com.au> Date: Fri, 23 Nov 2001 20:11:23 -0800 From: Peter Wemm Message-Id: <20011124041123.C0DE038FF@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Peter Wemm wrote: > Luigi Rizzo wrote: > > In order to port my network polling stuff to current, I was looking > > at ways to do things within the "idle loop", and was pointed to > > the idle_proc() or vm_pagezero() . I am listing below the code > > for these kernel threads (I hope the name is the correct one). > > idle_proc isn't a real process. It has to be guaranteed to be runnable > at any time. pgzero is a real idle priority thread. > > > I do not follow, however, the reason why these two threads periodically > > give up the CPU, given that their priority is (i guess) lower than > > any other thread in the system, so any event that should wake up > > a thread would immediately cause their preemption. > > Where am i wrong ? > > processes while in kernel mode cannot be preempted by another higher > priority process. Once they have the cpu, they either have to return > to userland (which kernel threads dont do), or block on something, or give > up the cpu. One additional comment.. John Baldwin has a work-in-progress that addresses a lot of these issues. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message