Re: LWLock contention: I think I understand the problem
От | Jeffrey W. Baker |
---|---|
Тема | Re: LWLock contention: I think I understand the problem |
Дата | |
Msg-id | Pine.LNX.4.33.0112291220230.30167-100000@windmill.gghcwest.com обсуждение исходный текст |
Ответ на | LWLock contention: I think I understand the problem (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Sat, 29 Dec 2001, Tom Lane wrote: > After some further experimentation, I believe I understand the reason for > the reports we've had of 7.2 producing heavy context-swap activity where > 7.1 didn't. Here is an extract from tracing lwlock activity for one > backend in a pgbench run: ... > 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. Sounds reasonable enough, but there seems to be a possibility of a process starving. For example, if A releases the lock, B and C wake up, B gets the lock. Then B releases the lock, A and C wake, and A gets the lock back. C gets CPU time but never gets the lock. BTW I am not on this list. -jwb
В списке pgsql-hackers по дате отправления: