By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

Lock questions

P: n/a
Hello,
i've been reading the README file in the lmgr folder (in src/backend/storage/lmgr/) and i have a couple of questions about locks:
- What's the difference between the Lightweight Locks (LWLocks) and the Regular locks (Heavyweight Locks)? For example, if i do a query and it needs a lock, would it be a lightweight one or a regular one?

- There are two lock methods, DEFAULT and USER. Where can I get more information about them? In the README file it says that "USER locks are non-blocking", how could this be?

Thank you very much!
__________________________________________________ __________
http://webmail.wanadoo.es. Tu correo gratuito, rápido y en español
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Fernando <pr*********@wanadoo.es> writes:
i've been reading the README file in the lmgr folder (in src/backend/storage/lmgr/) and i have a couple of questions about locks:
- What's the difference between the Lightweight Locks (LWLocks) and
the Regular locks (Heavyweight Locks)?
IIRC the differences are explained in that same README: no deadlock
detection in LWLocks is one of the more critical ones.
For example, if i do a query and it needs a lock, would it be a lightweight one or a regular one?
All user-accessible locks are regular locks. LWLocks are used for
system internal processing (where, hopefully, we can prove that the
access pattern can't deadlock...). As an example, the regular lock
manager uses an LWLock to protect against simultaneous modifications
to its own data structures.
- There are two lock methods, DEFAULT and USER. Where can I get more

information about them? In the README file it says that "USER locks are
non-blocking", how could this be?

See contrib/userlock/

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.