caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Kerneis <gabriel@kerneis.info>
To: Pierre Chambart <pierre.chambart@laposte.net>
Cc: Xavier Leroy <Xavier.Leroy@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Thread behaviour
Date: Tue, 1 Oct 2013 08:21:15 +0100	[thread overview]
Message-ID: <20131001072115.GB3894@kerneis.info> (raw)
In-Reply-To: <524A573B.4030903@laposte.net>

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

  reply	other threads:[~2013-10-01  7:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 10:10 Tom Ridge
2013-09-27 10:22 ` Simon Cruanes
2013-09-27 10:27 ` Romain Bardou
2013-09-27 10:51   ` Benedikt Grundmann
2013-09-28 19:09     ` Tom Ridge
2013-09-29  7:54       ` Tom Ridge
2013-09-29 12:37         ` Yaron Minsky
2013-09-29 16:25           ` Tom Ridge
2013-09-29 16:46             ` Chet Murthy
2013-09-29 17:18               ` Tom Ridge
2013-09-29 17:47                 ` Chet Murthy
2013-09-30  8:24                   ` Romain Bardou
2013-10-07 14:57                     ` Goswin von Brederlow
2013-09-30  8:16       ` Romain Bardou
2013-10-01  3:32         ` Ivan Gotovchits
2013-10-07 14:49       ` Goswin von Brederlow
2013-09-30  9:18 ` Xavier Leroy
2013-09-30 15:12   ` Tom Ridge
2013-09-30 16:01     ` Török Edwin
2013-09-30 16:56     ` Gabriel Kerneis
2013-09-30 18:18       ` Alain Frisch
2013-10-01  5:01   ` Pierre Chambart
2013-10-01  7:21     ` Gabriel Kerneis [this message]
2013-10-02 10:37     ` Wojciech Meyer
2013-10-02 11:52       ` Francois Berenger
2013-10-02 11:58         ` Wojciech Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131001072115.GB3894@kerneis.info \
    --to=gabriel@kerneis.info \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=pierre.chambart@laposte.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).