From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 30 14:24:02 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37DE6106564A; Fri, 30 Mar 2012 14:24:02 +0000 (UTC) (envelope-from hans@beastielabs.net) Received: from mail.beastielabs.net (beasties.demon.nl [82.161.3.114]) by mx1.freebsd.org (Postfix) with ESMTP id A30828FC17; Fri, 30 Mar 2012 14:24:00 +0000 (UTC) Received: from merom.hotsoft.nl (merom.hotsoft.nl [192.168.0.12]) by mail.beastielabs.net (8.14.5/8.14.5) with ESMTP id q2UEKCi1030926; Fri, 30 Mar 2012 16:20:13 +0200 (CEST) (envelope-from hans@beastielabs.net) Message-ID: <4F75C11C.3060002@beastielabs.net> Date: Fri, 30 Mar 2012 16:20:12 +0200 From: Hans Ottevanger User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.3) Gecko/20120314 Thunderbird/10.0.3 MIME-Version: 1.0 To: Mahesh Babu References: <1333041495.92141.YahooMailNeo@web193201.mail.sg3.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-hackers@freebsd.org" , Giovanni Trematerra Subject: Re: Context Switch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2012 14:24:02 -0000 On 03/30/12 15:36, Giovanni Trematerra wrote: > On Thu, Mar 29, 2012 at 7:18 PM, Mahesh Babu wrote: >> Which part of the source code in FreeBSD 9 is responsible for making context switching i.e. storing and restoring the process state. >> > > Context switch is split up in machine indipendent code (MI Code) and > machine dependent code (MD Code) > > For MI part take a look at > mi_switch in sys/kern/kern_sync.c > sched_switch in sys/kern/sched_ule.c and sys/kern_4bsd.c depending on > configurated scheduler in the kernel config file. > > For MD part search for symbol cpu_switch inside the specific arch directory. > For background information you could read "The Book" (a bit dated but still quite relevant): http://www.informit.com/store/product.aspx?isbn=0201702452 And you are especially lucky, since the chapter that is the most relevant to you is freely available on-line: http://www.informit.com/articles/article.aspx?p=366888 Kind regards, Hans Ottevanger