From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id C728A7EE4B for ; Tue, 1 Oct 2013 09:21:18 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel@kerneis.info) identity=pra; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="gabriel@kerneis.info"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel@kerneis.info designates 176.31.113.173 as permitted sender) identity=mailfrom; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="gabriel@kerneis.info"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@wanbli.kerneis.info designates 176.31.113.173 as permitted sender) identity=helo; client-ip=176.31.113.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel@kerneis.info"; x-sender="postmaster@wanbli.kerneis.info"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhgFAMV2SlKwH3Gt/2dsb2JhbABaFoJxOMFUgTEWdIIlAQEDAjoGAQE3AQ8LGAkTEg8FKCGIHQipe4RQAQWOWgaPUQeDH4EDjmuJFoYnDYtHgyU X-IPAS-Result: AhgFAMV2SlKwH3Gt/2dsb2JhbABaFoJxOMFUgTEWdIIlAQEDAjoGAQE3AQ8LGAkTEg8FKCGIHQipe4RQAQWOWgaPUQeDH4EDjmuJFoYnDYtHgyU X-IronPort-AV: E=Sophos;i="4.90,1012,1371074400"; d="scan'208";a="35015300" Received: from wanbli.kerneis.info ([176.31.113.173]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 01 Oct 2013 09:21:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kerneis.info; s=wanbli-rsa1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=DyWImX+DmxRP9jNmrV19rEqUyiHZ04wfVmUzZyc+crc=; b=kZHbHXN4NftQ87R4b0VHuNfod+Y4CVyqLbDgsJ/gC/HV8PwqJpD/R0Pq4TwGFGELC8DSVSYslHgtu3wMWshjK2J9pTHY/HRRaPm9rjTNGTlEpg1DFxZt4/LYP68MmpaTdK5ZGZH4mEXVQwiHNzsWL8j7tli4W1jkqc900BeTRFk=; Received: from [176.248.6.84] (helo=wacehi.kerneis.info) by wanbli.kerneis.info with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VQuGj-0003YM-6r; Tue, 01 Oct 2013 07:21:17 +0000 Received: from gabriel by wacehi.kerneis.info with local (Exim 4.80) (envelope-from ) id 1VQuGh-00015s-TZ; Tue, 01 Oct 2013 08:21:15 +0100 Date: Tue, 1 Oct 2013 08:21:15 +0100 From: Gabriel Kerneis To: Pierre Chambart Cc: Xavier Leroy , caml-list@inria.fr Message-ID: <20131001072115.GB3894@kerneis.info> References: <524941CC.1080906@inria.fr> <524A573B.4030903@laposte.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <524A573B.4030903@laposte.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 176.248.6.84 X-SA-Exim-Mail-From: gabriel@kerneis.info X-SA-Exim-Scanned: No (on wanbli.kerneis.info); SAEximRunCond expanded to false Subject: Re: [Caml-list] Thread behaviour On Tue, Oct 01, 2013 at 01:01:47AM -0400, Pierre Chambart wrote: > > It all depends on the whim of the OS scheduler. OCaml has no control > > over it. And you shoudn't expect any kind of fairness from the OS > > scheduler, esp. Linux's, which gladly jettisons any pretense of > > fairness in the hope of getting better throughput. > Usualy, the scheduler is fair when you force all threads to run on the > same processor. I wouldn't be so sure if I were you. Have a look for example at the first line of Table 6.2, page 141 of: http://www.pps.univ-paris-diderot.fr/~kerneis/research/files/kerneis-phd-thesis.pdf On a single core, creating a new thread, then calling sched_yield until the CFS switches to it takes an absurd amount of time. (This micro-benchmark is arguably very bad style for POSIX threads, but it serves to illustrate how confusing the CFS behaviour can be.) On two cores, on the other hand, sane behaviour is restored. -- Gabriel