Re: Lock and Waiters

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "kenneth d'souza" <kd_souza(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Lock and Waiters
Date: 2007-08-01 15:22:17
Message-ID: 20070801152217.GG6165@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

kenneth d'souza wrote:

> <DIV>Let us imagine if there is Process P which is holding a lock and
> there are individual waiters p1 p2 p3 p4 p5 p6 requiring the same
> lock. Now since they are in conflict it is sure that there will be
> wait queue that will get generated as in p1 p2 p3 p4 p5 p6.
> <BR>Imagine if Process P releases it lock. As per explaination given
> in (a) it is sure that p1 will wake up. What is the status of p2. It
> was in conflict with process P and hence should we term it that it
> will not wake up. Same is the case with p2 ... p6. </DIV>

If p2's requested lock does not conflict with p1's granted lock, then it
will be awakened also (for example if P had an AccessExclusive lock and
both p1 and p2 were requesting an AccessShare lock).

> <DIV>Secondly if p2 is not woken up and if p3's lock doesn't conflict
> with&nbsp; ( P and p2 ) then by rule(b) will p3 move ahead&nbsp; of
> p2</DIV>

No, sleeping waiters are not moved ahead.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-08-01 15:27:23 Re: HOT patch - version 11
Previous Message Peter Eisentraut 2007-08-01 13:22:52 Re: How do I connect postgres table structures and view structures to an existing svn repository?