From owner-freebsd-questions@FreeBSD.ORG Mon Mar 28 20:13:55 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B493516A4CE for ; Mon, 28 Mar 2005 20:13:55 +0000 (GMT) Received: from mail24.sea5.speakeasy.net (mail24.sea5.speakeasy.net [69.17.117.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D7A143D1F for ; Mon, 28 Mar 2005 20:13:55 +0000 (GMT) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: (qmail 14772 invoked from network); 28 Mar 2005 20:13:54 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail24.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Mar 2005 20:13:54 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id B13C92E; Mon, 28 Mar 2005 15:13:52 -0500 (EST) Sender: lowell@be-well.ilk.org To: Bahadir Balban References: From: Lowell Gilbert Date: 28 Mar 2005 15:13:52 -0500 In-Reply-To: Message-ID: <44hdiv34vz.fsf@be-well.ilk.org> Lines: 44 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: freebsd-questions@freebsd.org Subject: Re: definition of soft/hard interrupts. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2005 20:13:55 -0000 Bahadir Balban writes: > In "The design and implementation of 4.4BSD", the execution of I'm not sure this affects any of your particular questions, but that book is definitely outdated at this point... > workqueues, some timer events and scheduling are referred to as > "software interrupts", as well as system calls. I thought only system > calls would be in "soft interrupt" category as they are initiated with > a software interrupt instruction. A software interrupt actually has its own process context that runs within the lower half of the kernel. Device interrupts are usually handled by packaging the event and passing it to a software interrupt context for handling. I don't think it has to be implemented with a CPU software interrupt instruction. > By my definition, a hardware interrupt is one that is notified by the > interrupt controller, and to my knowledge, timer events are hardware > interrupts. Am I wrong? > > There's also a softclock and hardclock defined. It is as if, an > interrupt handler for an interrupt reported on the controller, is > termed as "hard", but a low-priority workqueue initiated by a later > timer event is called as a "software interrupt" here. The distinction > here mainly being made by their "priority". Would you confirm this? That's correct, but there are a couple of additional details that might make it more clear. Those software interrupts can be scheduled by other device interrupts as well -- the canonical example is a "hard" interrupt servicing a network interface card by setting up the received packet for the software interrupt to handle later, and then re-enabling the card for the next packet. > In my opinion this isn't the way to put it and software interrupts > should only mean interrupts initiated by interrupt instructions. I suspect the usage dates to before the invention of software interrupt opcodes. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/