From owner-freebsd-current Fri Nov 23 15:29:43 2001 Delivered-To: freebsd-current@freebsd.org Received: from mass.dis.org (mass.dis.org [216.240.45.41]) by hub.freebsd.org (Postfix) with ESMTP id 6F0CF37B405; Fri, 23 Nov 2001 15:29:41 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.3) with ESMTP id fANNWkf02358; Fri, 23 Nov 2001 15:32:46 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200111232332.fANNWkf02358@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Luigi Rizzo Cc: John Baldwin , current@FreeBSD.org Subject: Re: where is the idle_loop in current ? In-reply-to: Your message of "Fri, 23 Nov 2001 15:15:22 PST." <20011123151522.B58238@iguana.aciri.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 23 Nov 2001 15:32:46 -0800 From: Mike Smith 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 > 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). You should just schedule a thread with priority equal to or just above that of the idle 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 ? Spinning forever in a thread is always a bad idea; you can't be assured that you will always be preempted. The idle thread calls the scheduler periodically for just this reason; it's a safer design. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message