Re: LWLock contention: I think I understand the problem

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, "Jeffrey W(dot) Baker" <jwbaker(at)acm(dot)org>
Subject: Re: LWLock contention: I think I understand the problem
Date: 2001-12-29 19:35:49
Message-ID: 200112291935.fBTJZnU28166@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-odbc

> It would seem, therefore, that lwlock.c's behavior of immediately
> granting the lock to released waiters is not such a good idea after all.
> Perhaps we should release waiters but NOT grant them the lock; when they
> get to run, they have to loop back, try to get the lock, and possibly go
> back to sleep if they fail. This apparent waste of cycles is actually
> beneficial because it saves context swaps overall.

I still need to think about this, but the above idea doesn't seem good.
Right now, we wake only one waiting process who gets the lock while
other waiters stay sleeping, right? If we don't give them the lock,
don't we have to wake up all the waiters? If there are many, that
sounds like lots of context switches no?

I am still thinking.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-12-29 19:37:15 Re: LWLock contention: I think I understand the problem
Previous Message Thomas Lockhart 2001-12-29 19:24:02 Re: LWLock contention: I think I understand the problem

Browse pgsql-odbc by date

  From Date Subject
Next Message Bruce Momjian 2001-12-29 19:37:15 Re: LWLock contention: I think I understand the problem
Previous Message Thomas Lockhart 2001-12-29 19:24:02 Re: LWLock contention: I think I understand the problem