three locks and lock order reversal?
=?gb2312?q?popsong=20old?=
oldpopsong at yahoo.com
Thu Feb 5 18:06:19 PST 2004
> If one thread does A then B, another thread does B then C, and a third thread
> does C then A you can deadlock if each thread gets the first lock and blocks
> on the second lock. Thread 1 wants B and holds A, thread 2 holds B and wants
> C, and thread 3 wants A and holds C. Thread 3 will not giveup C until it
> gets A. Thread 1 holds A and won't give it up until it gets B. Thread 2
> holds B and won't give it up until it gets C which is held by thread 3.
> Hence, deadlock.
>
> --
> John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve" = http://www.FreeBSD.org
>
Thank you for the explanation! I only thought of two threads. So this bring me
another question: if the machine only have 2 CPUs, does it mean that this kind
of LOR is safe, provided there is no other sleep lock between A and B, B and C,
C and A?
song
_________________________________________________________
Do You Yahoo!?
ÍêÈ«Ãâ·ÑµÄÑÅ»¢µçÓÊ£¬ÂíÉÏ×¢²á»ñÔù¶îÍâ60Õ×ÍøÂç´æ´¢¿Õ¼ä
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.mail.yahoo.com
More information about the freebsd-current
mailing list