From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 2 19:31:27 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CE8F5274; Tue, 2 Apr 2013 19:31:27 +0000 (UTC) (envelope-from vasanth.raonaik@gmail.com) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx1.freebsd.org (Postfix) with ESMTP id EF2A72CF; Tue, 2 Apr 2013 19:31:26 +0000 (UTC) Received: by mail-lb0-f171.google.com with SMTP id v10so845899lbd.30 for ; Tue, 02 Apr 2013 12:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=OXPAvzPeG3/alHQrSJEi/0Mf0C1lyvKgeCY4Hh1hBVY=; b=BFNFn24yJgNOz2S1+MENLhros+4fvq6oTQ3g9opmAQbivQiHHrQsK94ycOOAkz+C3a sRSlGHAqFOPUUI2Pv7gjVZPDL3lJlX/nQOCCYqWUkVBpMpjTyrX6MzIYgwMGRL9+vVfK eG3p+MWj+AsrOomrYk/h9Cba304twBnBK6IZ7+svzb2eU0dEodyE9IyyQIrKCxkk6iFe yFl/yJizzM7Dbg0hopJq4y1rNbdBYWMASPw20swW84S/t/1B8H3J+Ggwn9GS5EIcG/aN 3McybX3D8GFNkyN2Qtes3wzQ1TgbnCNEbFaERUZ0lVjjepdjKtFfydrQrv/JreDVUrJi 3Rag== MIME-Version: 1.0 X-Received: by 10.152.46.12 with SMTP id r12mr8446468lam.15.1364931079828; Tue, 02 Apr 2013 12:31:19 -0700 (PDT) Received: by 10.112.138.33 with HTTP; Tue, 2 Apr 2013 12:31:19 -0700 (PDT) In-Reply-To: <201304011433.23781.jhb@freebsd.org> References: <201304011433.23781.jhb@freebsd.org> Date: Tue, 2 Apr 2013 15:31:19 -0400 Message-ID: Subject: Re: preemptive kernel From: vasanth rao naik sabavat To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-hackers@freebsd.org, Adrian Chadd X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2013 19:31:27 -0000 Thanks John, That is helpful. On Mon, Apr 1, 2013 at 2:33 PM, John Baldwin wrote: > On Friday, March 22, 2013 4:10:16 pm vasanth rao naik sabavat wrote: > > Hi Adrian, > > > > Just to clarify, is the kernel pre-emption involuntary? > > > > Let say I have a kernel thread processing a huge list of entries, would > > this thread get involuntarily context switched out because of kernel > > preemption? > > > > What is the time slice after which a kernel thread can involuntarily > > context switched out? > > > > Could you please point to the file in the source code which handles the > > kernel pre-emption. > > In-kernel preemption is driven by interrupts, not time slices. If an > interrupt arrives that awakens a higher priority thread (e.g. an interrupt > thread), or if your thread awakens a thread that has higher priority (e.g. > due > to wakeup() or cv_signal()), then your thread will be preempted. > > In general time-based preemptions are only done for user threads. > > -- > John Baldwin > -- Thanks, Vasanth