Re: lwlocks and starvation

From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: lwlocks and starvation
Date: 2004-11-24 12:18:23
Message-ID: 41A47C0F.5030000@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> My guess is the existing behavior was designed to allow waking of
> multiple waiters _sometimes_ without starving of exclusive waiters.

Well, I think the current algorithm *does* allow starvation, at least in
some situations. Consider a workload in which a new shared reader
arrives every 50 ms, and holds the lock for, say, 500 ms. If an
exclusive waiter arrives, they will starve with the current algorithm.

> There should be a comment in the code explaining this usage and I bet it
> was intentional.

Oh, I bet it was intentional as well :) I'm mostly curious to see
exactly what the reasoning was, and whether it is necessary that we
preserve the FIFO behavior while considering optimizations.

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-11-24 12:34:26 Re: lwlocks and starvation
Previous Message Bruce Momjian 2004-11-24 11:55:03 Re: lwlocks and starvation