Operating system-deadlock-related

Source: Internet
Author: User

Operating system-deadlock-related

1, deadlock: In the computer system there are many mutually exclusive resources (such as printers) or software resources (such as critical section), if two processes use the printer at the same time, or at the same time to enter the critical section of the inevitable problems. The so-called deadlock, refers to more than two processes each other requires the other has been occupied by the resources of the phenomenon can not continue to run.

2. The necessary conditions for the deadlock to occur:

(1) Mutually exclusive condition: that is, a resource can only be used by one process at a time, in the operating system this is the case of real existence.

(2) Hold and wait conditions: one process has obtained some resources, but the resources that have been obtained are kept in place when requests for other resources are blocked.

(3) Conditions of deprivation: some system resources are inalienable, and when a process has acquired such resources, the system cannot be forcibly retracted, and can only be released by the process when it is exhausted.

(4) Loop wait condition: Several processes form a ring chain, each occupying the next resource to be requested by the other.

3, deadlock prevention: deadlock prevention is the adoption of a strategy to limit the concurrent process to the resources of the request, the destruction of the deadlock caused by one of the 4 necessary conditions, so that the system at any time do not meet the requirements of deadlock.

(1) Pre-static allocation method. The "inalienable conditions" were undermined. Pre-allocating the required resources to ensure that no resources are waiting. The problem with this approach is to reduce requests for resources, reduce the concurrency of the process, and sometimes you may not know the resources you need beforehand.

(2) The method of orderly allocation of resources. The "loop condition" was destroyed. Classify the resources in order. Ensure that no loops are formed. The problem with this method is to limit the process's requests to resources, and the resource's ordering consumes overhead.

4, deadlock avoidance: Avoid refers to the process in each application resources to determine whether these operations are safe, the typical algorithm is "banker algorithm." But this algorithm increases the overhead of the system.

5. Deadlock detection: Determine if the system is in a deadlock state, and if so, perform a deadlock cancellation policy.

6. Deadlock cancellation: Used in combination with deadlock detection, the way it is used is deprivation. The resource is forcibly assigned to another process.

For more information, please refer to: http://blog.csdn.net/a_long_/article/details/51222906

Operating system-deadlock-related

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.