Re: lwlocks and starvation - Mailing list pgsql-hackers

From Neil Conway
Subject Re: lwlocks and starvation
Date
Msg-id 41A47C0F.5030000@samurai.com
Whole thread Raw
In response to Re: lwlocks and starvation  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: lwlocks and starvation  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: lwlocks and starvation
Next
From: Bruce Momjian
Date:
Subject: Re: lwlocks and starvation