Conditions required for deadlock generation and solutions to deadlocks

Source: Internet
Author: User

Four Conditions for deadlock:

(1) mutex condition: A resource can only be used by one process at a time.

(2) request and retention conditions: when a process is blocked by requesting resources, it will not release the obtained resources.

(3) Non-deprivation condition: the resources obtained by the process cannot be forcibly deprived before they are used.

(4) Cyclic waiting condition: a cyclic waiting resource relationship is formed between several processes that are connected at the beginning and end.

These four conditions are necessary for a deadlock. As long as a deadlock occurs in the system, these conditions must be met. As long as one of the above conditions is not met, no deadlock will occur.

Deadlock elimination method:

1. Undo All deadlocked processes;

2. Undo the deadlocked process one by one until the deadlock does not exist;

3. Force the resources used one by one from the deadlocked process until the deadlock disappears.

4. Forcibly deprive other processes of sufficient resources and allocate them to the deadlock process to relieve the deadlock.

References: http://baike.baidu.com/view/121723.htm

Reference: http://zhidao.baidu.com/question/65925327

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.