From owner-freebsd-questions@FreeBSD.ORG Thu Oct 8 03:24:25 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2061C106566B for ; Thu, 8 Oct 2009 03:24:25 +0000 (UTC) (envelope-from pldrouin@pldrouin.net) Received: from smtp.cyberfingers.net (smtp.cyberfingers.net [198.177.254.227]) by mx1.freebsd.org (Postfix) with ESMTP id F22068FC0A for ; Thu, 8 Oct 2009 03:24:24 +0000 (UTC) Received: from mdaemon.pldrouin.net (CPE0023695b905f-CM001a666aca96.cpe.net.cable.rogers.com [99.246.67.95]) by smtp.cyberfingers.net (Postfix) with ESMTP id E9A40AB6C11 for ; Wed, 7 Oct 2009 23:21:33 -0400 (EDT) Message-ID: <4ACD5B80.9030703@pldrouin.net> Date: Wed, 07 Oct 2009 23:24:48 -0400 From: Pierre-Luc Drouin User-Agent: Thunderbird 2.0.0.23 (X11/20090824) MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: When is it worth enabling hyperthreading? 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: Thu, 08 Oct 2009 03:24:25 -0000 Hi, Could someone explain me in which cases it is useful to enable hyperthreading on a machine running FreeBSD 8.0 and in which other cases it is not a good idea? Is that possible that hyperthreading is disadvantageous unless the number of active (non-sleeping) threads is really high? For example, if I have an i7 CPU with 4 physical cores and that I run some multi-threaded code that has only 4 threads, it will run almost always (twice) slower with hyperthreading enabled than when I disable it in the BIOS. If I understand correctly, hyperthreading has the advantage of being able to do CPU context switching faster than the OS, but it does this context switching systematically instead of only when requested, so it slows things down unless the number of running (non-sleeping) threads is greater or equal to let say the number of physical threads x 1.5-1.75. Thanks!