caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@gmail.com>
To: Caml Mailing List <caml-list@inria.fr>
Subject: Re: Odd behavior with GC and Mutex.lock (resolved)
Date: Fri, 2 Sep 2005 17:40:08 -0400	[thread overview]
Message-ID: <891bd33905090214401b046fcb@mail.gmail.com> (raw)
In-Reply-To: <891bd339050831052665d380b2@mail.gmail.com>

For anyone who is interested, we've resolved this issue.  We were
mistaken to think this was a GC issue at all.  The long delays simply
resulted from some odd decisions by the Linux scheduler.  We resolved
them by changing SCHED_RR scheduling for the threads in question.

Yaron

On 8/31/05, Yaron Minsky <yminsky@gmail.com> wrote:
> I've been running into some very odd behavior with the GC and
> Mutex.lock.  We have an application where a bunch of threads are all
> pushing updates through a synchronized queue, so all of the threads are
> contending for a global lock.  Under some rare circumstances, we've seen
> very odd GC delays coming up, and we're at a bit of a loss to explain
> them.
> 
> The basic situation is that when the system comes under unusually high
> GC load, we will sometimes see one of the threads take a long time (on
> the order of half a second) when it tries to acquire the lock. We
> instrumented the acquisition of the lock as follows:
> 
> let pre_stat = Gc.quick_stat () in
> Mutex.lock mutex
> let post_stat = Gc.quick_stat () in
> 
> The thread that gets delays shows hundreds or thousands of minor
> collections and 5-10 major collections between the calls to
> Gc.quick_stat ().  What's also weird is that it's always the same thread
> that gets blocked, and other threads are not blocked during this period.
> They seem to be able to acquire and release the lock without problems.
> And the thread that does get delayed isn't even the one causing the
> unusual load (although the delayed thread does do a big chunk of
> allocation that is immediately unreachable right before it gets blocked).
> 
> I can't come up with a reasonable explanation for how this might happen,
> and I'm hoping someone with a deeper understanding of the GC than I
> might be able to help.
> 
> Yaron
>


      reply	other threads:[~2005-09-02 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-31 12:26 Odd behavior with GC and Mutex.lock Yaron Minsky
2005-09-02 21:40 ` Yaron Minsky [this message]

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=891bd33905090214401b046fcb@mail.gmail.com \
    --to=yminsky@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=yminsky@cs.cornell.edu \
    /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).