You are here: deadlocks « PHP Programming Language « IT news, forums, messages
deadlocks

Posted by Marcus on 09/09/05 02:20

Hello all,

I am trying to figure out when it is appropriate to use shared and
exclusive locks with InnoDB. Using shared locks (lock in share mode), I
can easily create a scenario with 2 clients that deadlocks - start 2
transactions, open 2 shared locks, and both try to insert a new row
before either commits.

Using exclusive locks (for update) I cannot come up with a scenario that
results in a deadlock, since the very nature of the exclusive lock means
no other queries should be able to access the row(s) in question until I
commit.

If this is the case, my question then is this: why would I ever use a
shared lock if doing so can result in deadlocks? There must be a reason
because we have them, and going through tutorials I can see HOW they are
used, but I am not sure what advantage they would have over exclusive
locks. It seems to me that exclusive locks are "safer", but I know I
must be overlooking something.

Thank you all in advance for your help.

Marcus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация