Machine-translated by Google. Questions are authored in English.
Top

Discussion

The simplest practical way to prevent deadlock over several locks is to

  • A.require every task to take them in one fixed order
  • B.give every lock a timeout and retry on failure
  • C.allow only one task at a time to take any lock
  • D.give the highest priority task the locks it needs first

Answer: A

A global order makes a circular wait impossible, and it costs nothing at run time - only discipline at design time. Timeouts and retries detect and recover from deadlock rather than preventing it, and can degenerate into livelock.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.