lwlocks and starvation

Поиск
Список
Период
Сортировка
От Neil Conway
Тема lwlocks and starvation
Дата
Msg-id 1101284611.12045.49.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: lwlocks and starvation  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: lwlocks and starvation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
LWLockRelease() currently does something like (simplifying a lot):
   acquire lwlock spinlock   decrement lock count   if lock is free     if first waiter in queue is waiting for
exclusivelock,     awaken him; else, walk through the queue and awaken     all the shared waiters until we reach an
exclusivewaiter   end if   release lwlock spinlock
 

This has the nice property that locks are granted in FIFO order. Is it
essential that we maintain that property? If not, we could instead walk
through the wait queue and awaken *all* the shared waiters, and get a
small improvement in throughput.

I can see that this might starve exclusive waiters; however, we allow
the following:
   Proc A => LWLockAcquire(lock, LW_SHARED); -- succeeds   Proc B => LWLockAcquire(lock, LW_EXCLUSIVE); -- blocks
ProcC => LWLockAcquire(lock, LW_SHARED); -- succeeds
 

i.e. we don't *really* follow strict FIFO order anyway.

-Neil




В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Arnold.Zhu"
Дата:
Сообщение: Re: How to make @id or $id as parameter name in plpgsql, is it available?
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Bitmap index