From owner-freebsd-questions@FreeBSD.ORG Sat Oct 1 08:02:05 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 26E5216A41F for ; Sat, 1 Oct 2005 08:02:05 +0000 (GMT) (envelope-from ertr1013@student.uu.se) Received: from pne-smtpout2-sn1.fre.skanova.net (pne-smtpout2-sn1.fre.skanova.net [81.228.11.159]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6C6F43D49 for ; Sat, 1 Oct 2005 08:02:03 +0000 (GMT) (envelope-from ertr1013@student.uu.se) Received: from falcon.midgard.homeip.net (212.181.162.201) by pne-smtpout2-sn1.fre.skanova.net (7.2.060.1) id 43297E3C003E6CAE for freebsd-questions@freebsd.org; Sat, 1 Oct 2005 10:02:02 +0200 Received: (qmail 36537 invoked by uid 1001); 1 Oct 2005 10:02:01 +0200 Date: Sat, 1 Oct 2005 10:02:01 +0200 From: Erik Trulsson To: Ansar Mohammed Message-ID: <20051001080201.GA36458@falcon.midgard.homeip.net> Mail-Followup-To: Ansar Mohammed , 'Kris Kennaway' , freebsd-questions@freebsd.org References: <20050930204601.GA31598@xor.obsecurity.org> <000901c5c63c$5c2fa190$0b02a8c0@northamerica.corp.microsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000901c5c63c$5c2fa190$0b02a8c0@northamerica.corp.microsoft.com> User-Agent: Mutt/1.5.9i Cc: freebsd-questions@freebsd.org, 'Kris Kennaway' Subject: Re: BGL X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2005 08:02:05 -0000 On Fri, Sep 30, 2005 at 11:58:14PM -0400, Ansar Mohammed wrote: > I love FreeBSD. I have been using it since 2.x. I have never had any > problems with it. Rock Solid. Never a single kernel panic. > > Then I come across this article in a comparison between Linux and FreeBSD > saying that FreeBSD has kernel locking issues. Specifically, a problem > nicknamed BGL or Big Giant Lock. It seems that it affects SMP systems under > high load. That is not really a "problem", but just a design decision that can lead to bad efficiency in a few situations. In FreeBSD 4.x (and earlier) the kernel is protected by a "Big Giant Lock" that means that at most one process can be inside the kernel at any given time. The reason for having such a lock is that otherwise much confusion could result when two processes try modify the same data structures at once. On a uni-processor system such a lock is not problem, since you only have a single process running at any given time anyway. On multi-cpu system where processes spend most of their time doing computations this is not a problem either, since the processes will spend very little time inside the kernel. On a multi-cpu system it can mean a loss of efficiency, if you have several processes all wanting to execute inside the kernel, but in unrelated ares of the kernel. In that situation the BGL will make sure that only one process is in the kernel at one time, and the other processes will have to wait for it, even if they theoretically could have run in parallell without any problems. In FreeBSD 5.x (and even more so in the upcoming 6.x) the BGL has mostly been split up into several locks which protect smaller parts of the kernel, meaning that two processes that want to run in unrelated parts of the kernel can run in parallell. This can lead to improved efficiency on multi-cpu systems, since processes won't have to wait for each other as often, but also leads to a slight slow-down on single-cpu systems, since processes entering the kernel now usually have to obtain (and release) several locks rather than a single lock. In short the BGL is not a problem that can lead to crashes or instability, but just can lead to inefficent use of the hardware on multi-cpu systems. > > How much do other OSes suffer from this? Depends. The BGL design is by far the easiest way to provide support for running on SMP hardware, and has therefore been used by many OSes at first. Several of them have since moved on to a more fine-grained locking design similar to what FreeBSD uses, in order to get the system to scale well to large machines. > > > > -----Original Message----- > > From: Kris Kennaway [mailto:kris@obsecurity.org] > > Sent: September 30, 2005 4:46 PM > > To: Ansar Mohammed > > Cc: freebsd-questions@freebsd.org > > Subject: Re: BGL > > > > On Thu, Sep 29, 2005 at 10:09:17PM -0400, Ansar Mohammed wrote: > > > Is the kernel locking issue with FreeBSD 4.x sorted out in 5.x? I can't > > seem > > > to get a proper answer. > > > > Perhaps because the above isn't a proper question? Yes, the BGL was > > pushed down a lot in FreeBSD 5. It still covers some parts of the > > kernel (less in 6), so if can be more precise about a specific > > "locking issue" then perhaps we can give a more precise answer. > > > > Kris > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Erik Trulsson ertr1013@student.uu.se